Summary of Responses

Juergen Wagner gandalf at csli.STANFORD.EDU
Tue Sep 6 10:33:30 AEST 1988


>In article <48200005 at hcx3> shirono at hcx3.SSD.HARRIS.COM writes:
>>In comp.unix.questions <1000 Aug 31, 1988>, leightsu at neptune.UUCP writes:
>>> It is not documented in the Ultrix and BSD4.3 doc sets that I have in 
>>> my possession. Am I missing something?
>>
>>Yes.  -c is not an option to su.  It is an option to sh, csh, ksh (and
>>I believe tcsh, as well).

In article <6246 at rpp386.Dallas.TX.US> jfh at rpp386.Dallas.TX.US (The Beach Bum) writes:
>...
>the -c may not be an option to su, but it works quite nicely, thank you.
>
[script deleted]
>
>what most likely is happening is that -c is being passed to the shell
>as the command and the command is being passed as the argument, which
>the shell then interprets as a command.  so, in the end everything works
>just fine.

Well, the manual for SunOS 4.0 (3.5 is the same) says:

    ...
    su [ - ] [ -f ] [ -c command ] [ username ]
    ...
    -c command
       Execute command after logging in as the new user.
    ...

Ultrix (T2.2-4A System #5) just has:

    su [ userid ]

Ok, next I tried HP-UX (HP-UX 6.0 and 5.x):

    su [ - ] [ name [ arg ... ] ]

and further down in the man page, it says:

    Any additional arguments  given  on  the  command  line  are
    passed  to  the program invoked as the shell, permitting the
    super-user  to  run   shell   procedures   with   restricted
    privileges.   When  using programs like sh(1), an arg of the
    form -c string executes string via the shell and an  arg  of
    -r will give the user a restricted shell.

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).

-- 
Juergen "Gandalf" Wagner,		   gandalf at csli.stanford.edu
Center for the Study of Language and Information (CSLI), Stanford CA



More information about the Comp.unix.questions mailing list