This shows you the differences between two versions of the page.
user:abrunda1:ssh2_script [2010/02/18 19:03] – created abrunda1 | user:abrunda1:ssh2_script [2010/02/18 19:04] (current) – abrunda1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | =====SSH2 Script===== | ||
+ | ssh2 | ||
+ | <code bash> | ||
+ | # | ||
+ | ipaddress=$1 | ||
+ | if [ -z " | ||
+ | then | ||
+ | echo " | ||
+ | echo "The correct syntax is \"ssh2 \" | ||
+ | fi | ||
+ | if [ -n " | ||
+ | then | ||
+ | echo -n " | ||
+ | read username | ||
+ | if [ -z " | ||
+ | then | ||
+ | username=" | ||
+ | echo -n " | ||
+ | read portnum | ||
+ | if [ -z " | ||
+ | then | ||
+ | portnum=" | ||
+ | ssh root@$ipaddress -p $portnum | ||
+ | fi | ||
+ | if [ -n " | ||
+ | then | ||
+ | ssh root@$ipaddress -p $portnum | ||
+ | fi | ||
+ | fi | ||
+ | if [ -n " | ||
+ | then | ||
+ | echo -n " | ||
+ | read portnum | ||
+ | if [ -z " | ||
+ | then | ||
+ | portnum=" | ||
+ | ssh $username@$ipaddress -p $portnum | ||
+ | fi | ||
+ | if [ -n " | ||
+ | then | ||
+ | ssh $username@$ipaddress -p $portnum | ||
+ | fi | ||
+ | fi | ||
+ | fi | ||
+ | </ |