cook over ssh connection (add host as last argument)
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 17 May 2009 15:33:23 +0000 (15:33 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 17 May 2009 15:33:23 +0000 (15:33 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@83 191e9f34-6774-4a6d-acfc-7664dacd4a2a

bin/cook.sh

index ab1c665..c224310 100755 (executable)
@@ -6,5 +6,10 @@ test -e $1 || ( echo "usage: $0 recepises/something"; exit )
 
 cat $1
 
-grep '[a-z]*@[a-z]*:[^$#]*[$#]' $1 | cut -d\# -f 2 | xargs -i sh -x -c "{}"
+ssh=''
+if [ ! -z $2 ] ; then
+       ssh="ssh $2"
+fi
+
+grep '[a-z]*@[a-z]*:[^$#]*[$#]' $1 | cut -d\# -f 2 | $ssh xargs -i sh -x -c "{}"