Source code for /home/gipetto1/top-frog.com/public_html/script_src/files/_ssh.sh

  1.  #!/bin/bash
  2.  #
  3.  # Server Nicknames
  4.  #
  5.  # ServerName
  6.  nickname='[email protected]';
  7.  nicknamepassword='12345';
  8.  nicknameextra='an extra reminder';
  9.  #
  10.  # etc...
  11.  
  12.  #
  13.  # Do not edit below this line
  14.  #
  15.  if ! [ $1 ]; then
  16.   echo '_ssh error:';
  17.   echo ' please enter a dev server address';
  18.   echo '';
  19.   exit 1;
  20.  fi
  21.  
  22.  SERVER=$(eval echo \${$1:=0});
  23.  PASSWORD=$(eval echo \${$1password:=0});
  24.  EXTRA=$(eval echo \${$1extra:=0});
  25.  
  26.  if ! [ $SERVER == 0 ]; then
  27.   # show extra
  28.   if ! [[ $EXTRA == 0 ]]; then
  29.   echo $EXTRA;
  30.   fi
  31.   # handle password
  32.   if ! [ $PASSWORD == 0 ]; then
  33.   echo $PASSWORD | pbcopy;
  34.   echo 'Password copied to clipboard, paste when prompted to connect';
  35.   else
  36.   echo '* No password recorded for $1';
  37.   echo '* add the password to this file to have it copied for you when connecting';
  38.   fi
  39.   # connect
  40.   if [[ $SERVER =~ '@' ]]; then
  41.   # we were provided user@server
  42.   ssh $SERVER;
  43.   else
  44.   # we were provided just server, assume server name as user name
  45.   ssh $SERVER@$SERVER;
  46.   fi
  47.  else
  48.   # error
  49.   echo '_ssh error:';
  50.   echo " server name '$1' not found";
  51.   echo '';
  52.   exit 2;
  53.  fi