Monday 20 August 2018

Neat shell script functions


Greps through a file to find a single line of data containing a server name and then ssh's to it
           
function goto() {             
      a=$(grep -B 20 "$1" /home/andy/dev/hanson/crane/fabfile.py | grep '\[' | tail -1 | cut -f 2 -d  "'")
      echo "ssh: "$a       
      ssh $a".corp.hanson.as"
}

No comments:

Post a Comment