[net.bugs.4bsd] login built-in of 4.[12]bsd csh ignores ".logout"

ado@elsie.UUCP (07/15/84)

When you use the built-in "login" command of the 4.[12]bsd "csh", it
fails to act as if you had done a "source ~/.logout".

If you want a "source ~/.logout" to be done on "login" commands,
add this line to your ".login" file:

	alias login 'source ~/.logout; unalias login; eval login \!*'

(The fact that both the unalias AND the eval are needed above seems like
a bug to me; who knows?)
--
	...decvax!allegra!umcp-cs!elsie!ado	(301) 496-5688
	(the DEC and VAX in decvax are Digital Equipment Corporation trademarks)

west@sdcsla.UUCP (Larry West) (07/18/84)

Actually, all you need to do is put a backslash ("\") in front of the 
``login'' command in the alias.   E.g.,

	alias login 'source ~/.logout; \login'

Either apostrophe (') or double-quote (") would work to quote this.   The
backslash just prevents the C-shell's alias lookup, but it doesn't work
on built-in commands, such as "cd".   Note that "login" is not a built-in,
it is "/bin/login".   This function of "\" is unfortunately under-documented.

{{  I rather like the `bug' (of "~/.logout" not being read when "login"   }}
{{  command is executed), and don't find it confusing, since I view the   }}
{{  "~/.logout" file as something which is read only when I do a "logout" }}
{{  command.								  }}

Hope this helps.
	-- Larry West, UC San Diego, Institute for Cognitive Science
	-- decvax!ittvax!dcdwest!sdcsvax!sdcsla!west
	-- ucbvax!sdcsvax!sdcsla!west
	-- west@NPRDC		{{ NOT: <sdcsla!west@NPRDC> [aarg!] }}

mark@cbosgd.UUCP (Mark Horton) (07/18/84)

> If you want a "source ~/.logout" to be done on "login" commands,
> add this line to your ".login" file:
> 
> 	alias login 'source ~/.logout; unalias login; eval login \!*'
> 
> (The fact that both the unalias AND the eval are needed above seems like
> a bug to me; who knows?)

Actually, this isn't a bug, it's just that you get a recursive invocation
of the alias if you don't disable it.  Here's a better way to do it:
	alias login 'source ~/.logout; "login" \!*'
Whenever you build an alias around itself, if the recursion isn't
head recursion, you'll need to quote the name.

ado@elsie.UUCP (07/21/84)

elsie!ado--
> If you want a "source ~/.logout" to be done on "login" commands,
> add this line to your ".login" file:
> 	alias login 'source ~/.logout; unalias login; eval login \!*'
cbosgd!mark--
> ...Here's a better way to do it:
>	alias login 'source ~/.logout; "login" \!*'

The second alias command above acts more like "su" than "login".
(To see what I mean:  set up the alias; ensure that you have a "~/.logout" file;
use the login alias; and then use logout.)  To have it act like "login" you'd
	alias login 'source ~/.logout; exec login \!*'

The first alias above causes the built-in login command of the csh to be used;
the second and third result in direct execution of "/bin/login".  So with the
first alias above you'll still get the csh's
	There are stopped jobs
warning when appropriate; you'll miss the warning with the other aliases.
Keeping the warning was the motive for having the "complicated" alias.
--
	...decvax!allegra!umcp-cs!elsie!ado	(301) 496-5688
	(DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)