Bash.rc And Environment Variables Not Loading On SSH

Posted By Weston Ganger

I was having some issues with my .bashrc file not being loaded when SSHing.

To fix it add this to the beginning of your .profile file.


# ~/.profile

# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
  . "$HOME/.bashrc"
fi

Also if you are running a non-interactive SSH shell such as when using Capistrano or another tool, you must make sure you set your variables before this line in your .bashrc


# ~/.bashrc

# PLACE YOUR ENVIRONMENT VARIABLES HERE

# If not running interactively, don't do anything
[ -z "$PS1" ] && return


Related External Links:

Article Topic:Software Development - Linux

Date:May 31, 2015