Skip to main content

A hidden gotcha regarding bash linked to sh (shell) in Ubuntu (Linux)

I was having some problems recently regarding settings inside a user's .bashrc file. When the user logged in their settings were not being picked up. I checked in /etc/passwd and saw that the user's shell was sh which was a symbolic link for bash. I assumed that because the shell was linked to bash it would have bash's behaviour - picking up .bash_profile, .bashrc, etc.

A search of bash's man page proved me wrong:
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible.
I.e. if it's called sh it works like sh!

Technorati Tags: , , , ,

Comments