Solved: Problem with bash login.

Steven W. Orr steveo at syslang.net
Fri Aug 4 09:35:01 EDT 2006


On Thursday, Aug 3rd 2006 at 22:24 -0400, quoth James R. Van Zandt:

=>>   > It is more useful to explain the semantics of bash initialization
=>>   > files then it is to call one "correct".
=>>
=>>   The authors of the (remarkably complete) man page for bash
=>>   apparently agree with you, since they made no arch pronouncements
=>>   about what is "right" and "wrong" usage of the files in question.
=>>   Instead, they just supplied (mostly in the INVOCATION section)
=>>   a fairly concise description of when those files come into play.
=>
=>I have always been frustrated by that part of the bash man page.  I
=>wish they would add an example or two.  Setting environment variables
=>in .bash_profile and not in .bashrc would be one.  I know another
=>issue is where to execute programs that print things out - like
=>fortune or calendar.  You don't want those to run every time you do
=>"ssh hostname somecommand" from another machine.  At present I have
=>
=>  calendar -f $HOME/.calendar
=>
=>in .profile, and also
=>
=>  calc(){
=>   perl -e "use Math::Complex; print (($1) . \"\\n\");"
=>  }
=>
=>Would there be advantages in moving either of those to .bash_profile?
=>There are a lot of combinations to work out.
=>
=>          - Jim Van Zandt

Instead of looking to the bash manpage for examples, look at the bash 
distribution. It comes with lots of examples.

As for your specific question, don't use .profile at all. Just use 
.bash_profile instead. Leave the calendar call in .bash_profile because
you want it to happen once at login. Put the calc function in your .bashrc 
because you will want to access it from subshells.



More information about the gnhlug-discuss mailing list