I wanted my cygwin terminal to automatically prompts me to login via SSH or to cancel and use local bash for whatever on my local machine. I found out the .bash_profile automatically runs on login so I made it call a external shell script with ./ssh_connect.sh to prompt for the two options of logging in by SSH or exiting the prompt and using cygwin's local bash environment. 
Here is the code for ssh_connect.sh :
Then update your .bash_profile with the line
./ssh_connect.sh
Thats all you need to do.
Here is the code for ssh_connect.sh :
   1 
   2  echo "Connect SSH?"
   3  select yn in "Yes" "No"; do
   4      case $yn in
   5          Yes ) ssh user@server; break;;
   6          No ) exit;;
   7      esac
   8  done
   9 
Then update your .bash_profile with the line
./ssh_connect.sh
Thats all you need to do.
 
No comments:
Post a Comment