how can .cshrc know if session is a login?
Jim Frost
madd at bu-cs.BU.EDU
Mon May 22 07:45:15 AEST 1989
In article <14551 at duke.cs.duke.edu> khera at cs.duke.edu (Vick Khera) writes:
|In article <434ccc08.bea3 at mach1.engin.umich.edu> brian at caen.engin.umich.edu (Brian Holtz) writes:
|>Howw can .cshrc know if a session is a login session?
|
|A simple way I do this is to test for the existence of an environment
|variable that gets set in .login such as NAME.
My solution is:
if ($?SUBSHELL) then
# do things that a non-login shell should do
else
# do things a login shell should do
setenv SUBSHELL "yes"
endif
This is particularly useful if you use SysV and don't have job
control, but regularly use something like Emacs which exits as if job
control existed:
if ($?SUBSHELL) then
alias % exit
alias fg exit
else
alias % echo No current job.
alias fg echo No current job.
setenv SUBSHELL "yes"
endif
alias bg echo "Open the pod bay doors HAL. I can't do that, Dave"
Just aliasing "%" and "fg" to "exit" has the annoying habit of logging
you out.
jim frost
madd at bu-it.bu.edu
More information about the Comp.unix.questions
mailing list