[comp.unix.shell] System-wide .login?

guy@auspex.auspex.com (Guy Harris) (11/04/90)

(This is *NOT* a "wizards" or "internals" question, so followups are
being redirected to "comp.unix.shell".  There is, as far as I know, no
mailing list gatewayed there; mail followups should probably be sent to
"info-unix", which I think still goes to "comp.unix.questions".)

>(What's "sylogin.com" and why is it better than ".login" ?!)

Well, one might be able to infer what it is from the subject line.

When a login C shell starts up, it sources ".cshrc" from the user's home
directory, and then ".login" from the user's home directory.  Some
versions of the C shell *also* will source a file from some system
directory, e.g. "/etc/csh.login" or whatever.

This is similar to what more recent versions of the Bourne and Korn
shell do; they source the ".profile" file from the user's home
directory, but also source "/etc/profile" as well.

The problem with

>How about --  'ln -s .login some_other_file' ?
>Or, simply have .login do nothing else but exec your preferred file?

is that the "other file" would be global, so nobody would be able to do
any customization of their environment.

The answer to the original question

>>In other words, is there a Unix file equivalent to sylogin.com in the VMS
>>world?

is "no", for a couple of reasons:

1) not everybody in UNIX uses the same shell; some use Bourne-compatible
   shells (Bourne shell, "ksh", "bash", etc.), while others use the C
   shell.  As such, there couldn't be *one* file equivalent to
   "sylogin.com" on a UNIX system that has the C shell.

2) not all UNIX shells directly support the notion of a global file of
   that sort.  Older versions of the Bourne shell don't, and most
   versions of the C shell don't (some do, such as the S5R4 C shell and,
   I think, the HP-UX C shell, and probably some others).

If not all shells support that notion, one thing you can do is have
everybody's ".login" or ".profile" file source the global file, although
those users may be allowed to edit or replace their ".login" or
".profile" file and have it not do so, so you may not be able to
guarantee that the global file will be executed. 

prc@erbe.se (Robert Claeson) (11/05/90)

In a recent article guy@auspex.auspex.com (Guy Harris) writes:

>If not all shells support that notion, one thing you can do is have
>everybody's ".login" or ".profile" file source the global file, although
>those users may be allowed to edit or replace their ".login" or
>".profile" file and have it not do so, so you may not be able to
>guarantee that the global file will be executed. 

Some sites force all their users to have a shell (commonly sh or ksh)
that reads a system global login file, and if they want csh or something
else, exec it from their .profile's.

-- 
Robert Claeson                  |Reasonable mailers: rclaeson@erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se@sunet.se
                                |  Perverse mailers: rclaeson%erbe.se@encore.com
These opinions reflect my personal views and not those of my employer.