Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: The "-" and "--" options (was Re: ${var:1:1:=y})

On 02/04/2015 05:52 PM, Kurtis Rader wrote:
On Wed, Feb 4, 2015 at 5:31 PM, Ray Andrews <rayandrews@xxxxxxxxxxx <mailto:rayandrews@xxxxxxxxxxx>> wrote:

    On 02/04/2015 03:47 PM, Lawrence Velázquez wrote:

        % echo - -

    Ok, the first hyphen gets eaten, and the next one is literal.
    Still, shouldn't
    single quotes make anything inside them literal?

The single-quotes simply inhibit the shell from performing any substitutions (e.g., of $var references) inside the quoted string. The quotes also inhibit splitting the string on $IFS boundaries; i.e., the shell will pass the resulting string as a single argument to the command. The echo command simply gets a hyphen whether or not you quoted it. The echo command has no way of knowing that it was originally enclosed in single-quotes.

Of course.  I get fuzzified about the handoff from the shell to external
commands.  A bonk on the head and all is clear. Never again.

Messages sorted by: Reverse Date, Date, Thread, Author