Skip to main content
Removed single quote "'" so somebody who copies/pastes it will not have to deal with fixing the syntax.
Source Link
ZygD
  • 2.5k
  • 12
  • 27
  • 43

Just put this in ~/.bashrc~/.bashrc or /etc/bash.bashrc/etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I am logged in remotely"
fi

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I am logged in remotely"
fi

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I am logged in remotely"
fi
Removed single quote "'" so somebody who copies/pastes it will not have to deal with fixing the syntax.
Source Link

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm"I am logged in remotely"
fi

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I am logged in remotely"
fi
deleted 88 characters in body
Source Link
Simon Sheehan
  • 9.2k
  • 12
  • 53
  • 71

David already basically answered your question, but let me give you a ready example.

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi

David already basically answered your question, but let me give you a ready example.

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi

Just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:

if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi
Source Link
Llamageddon
  • 1.5k
  • 2
  • 11
  • 14
Loading