LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   How to change .bashrc prompt for logging in via SSH. (https://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/how-to-change-bashrc-prompt-for-logging-in-via-ssh-766848/)

Amckin 11-04-2009 11:48 AM

How to change .bashrc prompt for logging in via SSH.
 
How do I change the .bashrc file to look different when using ssh to access my machine but stay the same for local logins? Thanks in advance.

ammorais 11-04-2009 12:48 PM

When login by ssh the $SSH_TTY variable is set.

Code:

if [ ! -n "$SSH_TTY" ]; then
  export PS1="\[\e[32;1m\][\u@\[\e[34;1m\]\H \W]# \[\e[0m\]"  # Local login
else
  export PS1="ssh-\[\e[32;1m\][\u@\[\e[34;1m\]\H \W]# \[\e[0m\]" # Ssh Login
fi



All times are GMT -5. The time now is 01:44 AM.