August 30, 2012 by admin
I converted a couple of old scripts to use get opts in order to make them flexiable so I thought it
would be fitting to just share a quick example with you guys.
cat << EOF
usage: $0 options
This script run excute the command on a remote server.
-h Show this message
-H Server to connect to
-C Command to run on host
while getopts "hH:C:v" OPTION
case $OPTION in
if [[ -z $HOST ]] || [[ -z $CMD ]]
ssh -i ~/.ssh/id_rsa root@$HOST "$CMD"
Sorry, comments are closed.