Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!oliveb!sun!gorodish!guy From: guy@gorodish.Sun.COM (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Summary of Responses Message-ID: <68426@sun.uucp> Date: 15 Sep 88 00:12:38 GMT References: <663@neptune.AMD.COM> <48200005@hcx3> <6246@rpp386.Dallas.TX.US> <5390@csli.STANFORD.EDU> Sender: news@sun.uucp Lines: 33 > 4.2 BSD UNIX seems to have the -c option, too. > > So far with the poll. I guess, one shouldn't rely on having it when > working under non-BSD systems (HP-UX, Ultrix). As most people said, the truth is: 1) "su" doesn't have a "-c" option. It is not in 4.2BSD, nor 4.3BSD, nor SunOS, nor System V (Release 2, Release 3). 2) UNIX shells tend to support a "-c" option, which tells them to take the argument to that option and execute it as a commmand. 3) The 4.2BSD, 4.3BSD, S5R2, and S5R3 "su" commands will pass any arguments after the user name to the shell that they invoke; the SunOS "su" command is derived either from the 4.2BSD or the 4.3BSD version (depending on the version of SunOS), and I expect that the Ultrix one is based on a 4.xBSD one and the HP-UX one is based on some S5 one. This is documented in the S5 man page, and that man page mentions that you can use "-c" with this. This is *not* documented in the 4BSD man page; the SunOS man page incorrectly states that "su" has a "-c" option, rather than correctly stating that arguments after the username are passed to the shell (the SunOS man page implies that "su -c " works, but it doesn't - you have to do "su -c "). The net result is that "su -c " runs the new user's shell (as specified in the password file, with a default of "/bin/sh"), with the arguments "-c" and "". For the shells in question (Bourne and C, and derivatives of same such as the Korn shell and "tcsh"), this causes them to execute the command .