Answer:
one line script
while [ 1 ]; do candidate=`find ./ -name "*.zip"`; for i in $candidate; do unzip $i; rm $i; done; left=`find ./ -name "*.zip" | wc -l`; if [ $left -eq 0 ]; then break; fi; done
.sh file
for row in {1..5}; do col=`expr $row + 1`; i=1; while [ $i -lt $col ]; do printf " %s_.zip" $i; i=`expr $i + 1` ; done ; j=`expr $i - 2`; while [ $j -gt 0 ]; do printf " _%s.zip" $j; j=`expr $j - 1`; done; printf "\n"; done
.sh file
https://github.com/vash-hsu/linux-shell/blob/master/triangle_zip.sh
1.1) 1_.zip has treasure.txt
1.2) _1.zip has treasure.txt, too. But 1_.zip has different SHA-1 from _1.zip
2.1) 2_.zip has both 1_.zip and _1.zip.
2.2) _2.zip has both 1_.zip and _1.zip. However, 2_.zip has different SHA-1 from _2.zip
3.1) 3_.zip has 1_.zip, 2_.zip, _2.zip and _1.zip.
3.2) the same story for _3.zip and others
.sh file
https://github.com/vash-hsu/linux-shell/blob/master/triangle_zip.sh


沒有留言:
張貼留言