Bash Shell Login Trouble

Tom H tomh0665 at gmail.com
Mon Sep 29 21:29:59 UTC 2014


On Mon, Sep 29, 2014 at 3:22 PM, Jay Ridgley <jridgley2 at austin.rr.com> wrote:
>
> I use an ssh connection to one of my systems. Initially when I login to the
> remote system my customized aliases do not function. If I issue a source
> .bashrc command. They work...
>
> For example:
>
> alias cls=clear
> alias ping3="ping -c3"
>
> Neither of these will work until I issue the source .bashrc command, then
> all is well.

"~/.bashrc" is only sourced if you're running an interactive,
non-login bash shell.

The default Ubuntu "~/.profile" has:

if [ -n "$BASH_VERSION" ]; then
  if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
  fi
fi

to ensure that "~/.bashrc" is sourced if you're running an
interactive, login bash shell.

Since you seem to have modified "~/.profile", you might have modified
"~/.bashrc" too.

If you don't have a code snippet to exit "~/.bashrc" if the shell
isn't interactive, you should use something like the default Ubuntu
"~/.bashrc":

case $- in
  *i*) ;;
    *) return;;
esac




More information about the ubuntu-users mailing list