Afenioux's Blog page

3am; darkness; Maintenance window closing. Safety net: rollback.

Super SCP

Written by Arnaud no comments
I use this script to scp files as root to the distant server, so that I don't need to type "root@"
eg : arnaud@local:~$./scp file srv:/root
# we check the last argument
if [ `echo ${!#} | grep ":"` ] ; then
        # we pop $@
        # sed s,a,b is same as sed s/a/b
        # but no need to escape / :-)
        list=$(echo $@ | sed s,\ ${!#},,)
        scp -r $list root@${!#}
        # we unshift $@
        list=$(echo $@ | sed s,$1\ ,,)
        scp -r root@$1 $list
Classified in : UNIX Tags : none

Comments are closed.

Rss feed of the article's comments