Change to enable readlink to work on Darwin (OS X).
Replaced $USER w/ $HOME to work on OS X.
Made path to bash shell configurable.
Added =~ for older versions of BASH