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

Printing arrays for use with $()

    Hi all :)

    I have a script which produces a list of files to stdout. It just
prints an array (namely, something like "print -l -- $array" right
now), and I want to use that list in this way:

    whatevercommand $(myscript)

    Obviously the above doesn't work because the spaces in the file
names are not quoted (special character like the square brackets are,
though), but I cannot do this:

    print -l -- ${(qq)array}

    for printing because then even the single quotes are quoted (this
happens too using three and four 'q' flags).

    Is there any way for printing the array to stdout and being able
to use that output as arguments for another command? Please note that
this is a script, not a function, so I cannot return the array, I
must print it :(

    Thanks a lot in advance, dudes :)

    Raúl Núñez de Arenas Coronado

Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...

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