I have a number of directories containing zips. I am trying to loop through each directory extracting the zips and placings them in a separate directory. In my script it is going into the first directory and performing the command but it is getting stuck and not moving to the next.
for f in ./*; do
i=0
[ -d $f ] && cd "$f" && for archive in somelog.log.*; do
((i++))
unzip -p $archive > ../extracted/extractedlog_$i.log
done
done
You need to undo the cd
. Add cd -
or cd "$OLDPWD"
at the end of the outer loop.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.