| Summary: | su man page confusing, probably incorrect | ||
|---|---|---|---|
| Product: | Documentation | Reporter: | Gregory Neil Shapiro <gshapiro> |
| Component: | Books & Articles | Assignee: | kensmith |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
Gregory Neil Shapiro <gshapiro@FreeBSD.org> writes: > Clearly the -c in these examples is not pointing at a login class. It is > pointing at a command to run. Sure a later example gives the even more > confusing: > > su -c staff man -c `catman /usr/share/man /usr/local/man /usr/X11R6/man' > > However, -c is never documented in the man page as pointing to a command > to run, which it in fact does do. That example actually contains a hint. The syntax is su [-] [-flms] [-c class] [login [args]] so in all examples, "man" is the "login"** and the "-c" which follows "man" is the "args" (to the login shell). The "-c" is documented in the "sh" (or is it "csh"?) manpages, on the assumption that the reader is using a shell which supports such a "-c" option. If it tripped you up, it could trip up others and should be improved. ** I almost wrote a PR once on that use of "login" in the syntax and description. "user" (as used by "passwd"), "username", "user-name", "login-name" or almost anything would be better than "login", especially in the text where it should be even longer, like "user account name". (The "login" "man" doesn't even log in. :) Responsible Changed From-To: freebsd-doc->kensmith I'll give this one a try. State Changed From-To: open->closed - Added clarification to how arguments are handled, as discussed with submitter. |
The su man page describes -c as: -c class Use the settings of the specified login class. Only allowed for the super-user. Yet the examples say: su man -c catman Runs the command catman as user man. You will be asked for man's password unless your real UID is 0. su man -c `catman /usr/share/man /usr/local/man /usr/X11R6/man' Same as above, but the target command consists of more than a sin- ... Clearly the -c in these examples is not pointing at a login class. It is pointing at a command to run. Sure a later example gives the even more confusing: su -c staff man -c `catman /usr/share/man /usr/local/man /usr/X11R6/man' However, -c is never documented in the man page as pointing to a command to run, which it in fact does do. Also note in the examples above that the quoting is wrong. If someone actually tries to run the given commands in the example, it will fail. The first quote has to be a normal single quote, not a back quote.