On Sun, May 18, 2008 at 06:40:26PM +0200, Oleg Verych wrote:
> Herbert Xu @ Sun, May 18, 2008 at 11:41:08PM +0800:
> 
> > > # (1) parameters to `printf`?
> > > 
> > > [EMAIL PROTECTED]:/tmp$ sh -c 'printf "-1"'
> > > printf: 1: Illegal option -1
> > 
> > This is expected.  Use printf -- if you want to disable option parsing.
> 
> [second] Again for `echo` it's not so, `printf` is a mean for "propper"
>          (portable) `echo`, nothing about getopt() stuff is mentioned in
>        POSIX spec.

All POSIX utilities accept -- by default.  The specification for
echo specifically forbids --, while that of printf does not.

> > > # (3) '\' in `` and in $();
> > > # what is POSIX "literal meaning" of '\' in `` and what is '\\' then?
> (bash removed)
> 
> $( ' \\\\ ' ) ; ` ' \\\\ ' ` ; $( ' \\\ ' ) ; ` ' \\\ ' `
>       (4)            (2)            (3)           (2)
> $( " \\\\ " ) ; ` " \\\\ " ` ; $( " \\\ " ) ; ` " \\\ " `
> 
> it is so, but how to explain this wrt spec.?

Section 2.6.3, "Command Substitution":

            Within the backquoted style of command substitution, backslash
            shall retain its literal meaning, except when followed by:
            '$', '`', or '\\' (dollar sign, backquote, backslash).

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to