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

Little doubt about an expansion flag



    Hi all :))

    When looking at the recipe Oliver gave me for getting the pid of
a running process a few days ago, I discovered the (f) flag to
parameter expansion, which, according to the manual, means that the
expansion is split into lines (a shorthand for (ps:\n:).

    Why is this splitting needed? I mean, the recipe is:

    ${${${(M)${(f)"$(ps xh)"}:#*$name*}## #}%% *}

    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!!!

    Obviously there is something I don't understand in the (f) flag
and in word splitting O:))) It can even be my bad english, who knows?

    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) "}".
There are more of these ambiguities? How deals the shell with them?

    Please excuse me for making so many questions about Zsh, but I
really want to know more of this shell. I'm amazed! Thanks a lot in
advance for being so kind with me when asking ;))

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/



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