commit 3ba6a377d0294c9d8aa4a4e35f576af39097b0b4
parent c4575a6567677f2c7536e6f000dbb47895d597bc
Author: sin <sin@2f30.org>
Date: Wed, 27 Nov 2013 17:48:18 +0000
No need to rm $listing in all paths just set up our trap properly
Diffstat:
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/itor b/itor
@@ -14,11 +14,10 @@ mkdir -p $ldir
listing=$(mktemp)
-trap 'rm -f $listing; exit 0' 2 15
+trap 'rm -f $listing; exit 0' 0 2 15
ssh $host "ls $rdir" > $listing
if [ ! $? -eq 0 ]; then
- rm $listing
exit 1
fi
@@ -29,7 +28,6 @@ while read f; do
done < $listing
if [ $idx -eq 0 ]; then
- rm $listing
echo "No files to serve"
exit 0
fi
@@ -61,5 +59,3 @@ done < $listing
escapedfile=$(echo ${f// /\\ })
rsync --partial --progress -av -e ssh $host:"$rdir/$escapedfile" "$ldir"
-
-rm $listing