commit 1a480e96c0b06b6998f670c0168524b918ecb0bd parent ed204477c9100c7d87e3322a836ee9e4380a7d79 Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Date: Wed, 27 Nov 2013 11:01:01 +0000 If no files are present bail out Diffstat:
M | destiny-get | | | 9 | +++++++-- |
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/destiny-get b/destiny-get @@ -1,13 +1,18 @@ #!/bin/sh listing=$(mktemp) -ssh destiny "ls torrents" > $listing +ssh amnezia "ls torrents" > $listing idx=0 while read f; do echo "$idx: $f" ((idx=idx+1)) done < $listing +if [ $idx -eq 0 ]; then + echo "No files to serve" + exit 0 +fi + isnum() { test "$1" && printf '%f' "$1" >/dev/null 2>/dev/null; } while :; do @@ -34,6 +39,6 @@ while read f; do done < $listing escapedfile=$(echo ${f// /\\ }) -rsync --partial --progress -av -e ssh destiny:"torrents/$escapedfile" ~/torrents +rsync --partial --progress -av -e ssh amnezia:"torrents/$escapedfile" ~/torrents rm $listing