bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: man page "-c" explanation clarity


From: Matthew Woehlke
Subject: Re: man page "-c" explanation clarity
Date: Tue, 23 Jan 2007 15:26:24 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.9) Gecko/20061206 Thunderbird/1.5.0.9 Mnenhy/0.7.4.0

Paul A. Clarke wrote:
The man page states, for the "-c" option:
       -c string If the -c option is present, then  commands  are  read from
                 string.   If  there are arguments after the string, they are
                 assigned to the positional parameters, starting with $0.
I think the phrase "arguments after the string" is confusing in that the "arguments" here are really still within "the string", not after.

I'd suggest slightly different wording, such as:
"... If argments follow the respective commands within the string, they are..."

No, that's wrong, because it is talking about positional parameters as seen by /the shell/, not anything that is subsequently executed.

For example, 'bash -c echo foo' does not do what you might expect. It runs the built-in "echo" in the modified environment '0=foo'. Try e.g. "bash -c 'echo 0=$0 @=$@' foo bar". This is not the same as subsequently passing arguments to a program, which must be done within the *single* argument to '-c'.

--
Matthew
Don't read this. What did I just tell you? Why are you still reading?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]