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

Re: Little doubt about an expansion flag

On Sat, Sep 06, 2003 at 09:43:19PM +0200, DervishD wrote:
>     and I'm looking (deciphering is more appropriate) at the first
> part, namely ${(f)"$(ps xh)"}. When doing this, the output of the ps
> command is *joined*, deleting the \n characters!!!

Nope, the \n characters are not deleted because of the double quotes.
Try this:

    echo "$(ps xh)"

You'll see that they are still there.  This is different from this:

    echo $(ps xh)

...where all the whitespace gets compressed and transformed into spaces.

>     Finally, I would like to know how the shell manages to parse
> this: "${(f)"$(ps xh)"}", because it seems that the shell can read my
> mind and parses the quotes nested, and not like "${(f)" $(ps xh) "}".

Yes, this happens inside ${...} -- quotes start over in their nesting.
This is easy to do because it is useless to say "${(f)" (since that's a
syntax error), so the parser has no conflicts in its parsing choices --
it just assumes that the quote can't possibly be closing of the first
quote because the brace expression isn't done yet.


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