bash on login.

Mel fbsd.questions at rachie.is-a-geek.net
Thu Sep 6 08:53:17 PDT 2007


On Thursday 06 September 2007 17:06:02 Albert Shih wrote:

> I'm using bash for standard shell, what I don't understand is when I'm
> connect by ssh on my server the bash don't parse .bashrc file.

man bash, section INVOCATION:
       A  login shell is one whose first character of argument zero is a -, or
       one started with the --login option.

       An interactive shell is one started without  non-option  arguments  and
       without the -c option whose standard input and error are both connected
       to terminals (as determined by isatty(3)), or one started with  the  -i
       option.   PS1 is set and $- includes i if bash is interactive, allowing
       a shell script or a startup file to test this state.

...

       When an interactive shell that is not a login shell  is  started,  bash
       reads  and executes commands from ~/.bashrc, if that file exists.  This
       may be inhibited by using the --norc option.  The --rcfile file  option
       will  force  bash  to  read  and  execute commands from file instead of
       ~/.bashrc.

Ssh is a login shell.

For most practical uses:
cat ~/.bashrc >> ~/.bash_profile && rm -f ~/.bashrc
and live happily ever after.

-- 
Mel


More information about the freebsd-questions mailing list