Login shell?
Maarten Litmaath
maart at cs.vu.nl
Sat Oct 15 08:05:18 AEST 1988
In article <511 at imec.UUCP> croes at imec.UUCP (Kris Croes) writes:
\A way to detect whether your .cshrc is executed the first time, or whether
\it is executed with a "source .cshrc" e.g. after you edited it is:
\
\< 1> # Test if new csh.
\< 2> set temp = /tmp/prompt$$
\< 3> history 1 > $temp
\< 4> if (-z $temp) then
\< 5> # This is the first time .cshrc is executed
\< 6> alias lpr `which lpr` \!\* \&
\< 7> else
\< 8> # This is when .cshrc is executed with 'source'
\< 9> endif
\<10> /bin/rm $temp
\<11> unset temp
The above can be done much easier, without the temp file:
------------------------------cut here------------------------------
if ($?history) then
echo You sourced .cshrc!
else
echo This is the first time!
set history=1 # or more :-)
endif
------------------------------cut here------------------------------
\The Demon King sends a "rm -r /" to your shell.
A "/bin/rm -rf $HOME" is more effective, in general :-)
--
Hippic sport: |Maarten Litmaath @ Free U Amsterdam:
a contradiction in terms.|maart at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list