diff options
author | shmibs <shmibs@gmail.com> | 2014-01-06 10:16:16 -0700 |
---|---|---|
committer | shmibs <shmibs@gmail.com> | 2014-01-06 10:16:16 -0700 |
commit | eb52ab2616e8e004499333656307d01c45c369ef (patch) | |
tree | a704f4c2abbfabb4dd2867cd333db48b3e323811 /.ftjerm/1/ssh.sh | |
download | dotfiles-eb52ab2616e8e004499333656307d01c45c369ef.tar.gz |
initial commit
Diffstat (limited to '.ftjerm/1/ssh.sh')
-rwxr-xr-x | .ftjerm/1/ssh.sh | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/.ftjerm/1/ssh.sh b/.ftjerm/1/ssh.sh new file mode 100755 index 0000000..002560c --- /dev/null +++ b/.ftjerm/1/ssh.sh @@ -0,0 +1,94 @@ +#!/bin/bash +input="" +filename="" +temp="" +action="" +destination="" +sleep .125s + +cd /home/shmibs/.ftjerm/1/commands + +while IFS="" read -r -e -d $'\n' -p "ssh: " -a input; do + history -s "$input" + + IFS=" " + input=($input) + + if [ -n "$input" ]; then + + if [ "${input[0]}" == "send" ]; then + destination="" + if [ "${input[1]}" == "general" ]; then + destination="gamarti6@general.asu.edu:/afs/asu.edu/users/g/a/m/gamarti6/" + fi + + if [ "${input[1]}" == "withg" ]; then + destination="shmibs@withg.org:/home/shmibs/" + fi + + if [ "${input[1]}" == "saguaro" ]; then + destination="gamarti6@saguaro.fulton.asu.edu:/home/gamarti6/" + fi + + if [ -n "$destination" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + temp=`basename $filename` + scp -r '/home/shmibs/$filename' '$destination$temp' + cd /home/shmibs/.ftjerm/1/commands + + fi + fi + + if [ "$input" == "sendp" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r /home/shmibs/$filename shmibs@withg.org:/home/shmibs/www/$temp + echo "http://withg.org/shmibs/$temp" | xclip -selection clipboard + fi + + if [ "$input" == "get" ]; then + cd ~ + read -r -e -d $'\n' -p "~/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r shmibs@withg.org:~/$filename ~/Desktop/$temp + fi + + if [ "$input" == "getp" ]; then + cd ~ + read -r -e -d $'\n' -p "~/www/" -a filename + cd /home/shmibs/.ftjerm/1/commands + temp=`basename $filename` + scp -r shmibs@withg.org:/home/shimbs/www/$filename ~/Desktop/$temp + fi + + if [ "${input[0]}" == "connect" ]; then + if [ "${input[2]}" != "-X" ]; then + unset ${input[2]} + fi + + destination="" + + if [ "${input[1]}" == "general" ]; then + destination=gamarti6@general.asu.edu + fi + + if [ "${input[1]}" == "withg" ]; then + destination=shmibs@withg.org + fi + + if [ "${input[1]}" == "saguaro" ]; then + destination=gamarti6@saguaro.fulton.asu.edu + fi + + if [ "$destination" != "" ]; then + ssh ${input[2]} $destination + fi + fi + + fi + +done |