#!/bin/sh # ConnectSSH.sh # 2007-12-03 # Chieh Cheng # http://www.CynosureX.com/ # GNU General Public License (GPL) Version 2, June 1991 scriptName=`echo $0 | sed s/\\\\/.*\\\\///g` if [ $# -ne 1 ] then echo " Usage: $scriptName \"alias\"" else alias="$1" scriptPath=`dirname $0` dataFile="${scriptPath}/ConnectSSH.txt" if [ -f "${dataFile}" ] then data=`grep "${alias}|" "${dataFile}"` if [ "${data}" = "" ] then echo "Alias '${alias}' does not exist in configuration file." else user=`echo "${data}" | cut -d "|" -f 2` host=`echo "${data}" | cut -d "|" -f 3` flag=`echo "${data}" | cut -d "|" -f 4` ssh ${flag} ${user}@${host} fi else echo "${dataFile} not found. Cannot proceed with connection." fi fi