fix adding of smart files
[sysadmin-cookbook] / bin / cook.sh
1 #!/bin/sh
2
3 # small helper to cook the recepie (start prompt parts in shell)
4
5 test -e $1 || ( echo "usage: $0 recepises/something"; exit )
6
7 cat $1
8
9 ssh=''
10 if [ ! -z $2 ] ; then
11         ssh="ssh $2"
12 fi
13
14 grep '[a-z]*@[a-z]*:[^$#]*[$#]' $1 | cut -d\# -f 2 | $ssh xargs -i sh -x -c "{}"
15