add -c (clean)

This commit is contained in:
tianyu 2014-10-29 21:27:40 +08:00
parent f8105e816d
commit f36bd713b3
1 changed files with 18 additions and 0 deletions

18
r2t.sh
View File

@ -8,6 +8,24 @@
#bash_version :4.3.11(1)-release
#==============================================================================
if [ $1 = "-c" ]; then
echo "cleaning..."
cd tars
for file in *.tar; do
RAR="${file%%.tar*}.rar"
echo "check \"$RAR\" ..."
if [ -f "../$RAR" ];then
echo "delete $RAR ..."
rm -i "../$RAR"
else
echo "$RAR not exist."
fi
done
cd ..
rm -ri tars
exit 0
fi
check_sub(){
echo "check sub."
SAVEIFS=$IFS # setup this case the space char in file name.