scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit fc8cd57094d00ccd8ad39e09db7ef0ca4eb809a3
parent 418dadb86eb043cabffae2a990d87f747ea77668
Author: sin <sin@2f30.org>
Date:   Tue, 26 Nov 2013 20:45:22 +0000

Add destiny-get script

Diffstat:
Adestiny-get | 38++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+), 0 deletions(-)

diff --git a/destiny-get b/destiny-get @@ -0,0 +1,38 @@ +#!/bin/sh + +listing=$(mktemp) +ssh destiny "ls torrents" > $listing +idx=0 +while read line; do + echo "$idx: $line" + ((idx=idx+1)) +done < $listing + +isnum() { test "$1" && printf '%f' "$1" >/dev/null 2>/dev/null; } + +while :; do + read -p "Your selection: " index + isnum $index + if [ $? -eq 0 ]; then + if [ $index -ge $idx ]; then + echo "invalid selection: $index" + continue + fi + else + echo "not a number: $index" + continue + fi + break +done + +idx=0 +while read line; do + if [ $index -eq $idx ]; then + break + fi + ((idx=idx+1)) +done < $listing + +rsync --partial --progress -av -e ssh destiny:"torrents/$line" torrents + +rm $listing