Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!lth.se!osiris!perf From: perf@efd.lth.se (Per Foreby) Newsgroups: comp.lang.perl Subject: Perlscript as login-shell Message-ID: Date: 12 Feb 91 23:12:53 GMT Sender: newsuser@lth.se (LTH network news server) Distribution: comp Organization: EFD, Lund Inst. of Technology, Lund, Sweden Lines: 24 I have written a small perl script which some users get as their login shell. The general idea is to make the workstation personal, but allow the owner to `su' to another user. The password file contains entries like `+user:' for authorized users and `+:::::/perl-script' which matces all other users. My approch (in pseudo-perl): if (getlogin () == $ENV{'USER'}) print ("sorry..."); else exec (login-shell-from-yellow-pages); The problem: I can't find any way to distinguish between `su user' and `su - user'. In c this is simple (*argv[0] == '-'), but perls $0 only gives me the name of the script. I fear the problem is without solution, but please surprise me! -- -- Per Foreby; perf@efd.lth.se; LTH-E, Box 118, S-221 00 LUND, Sweden; 046-107492