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

Re: Printing arrays for use with $()

    Hi Bart :)

 * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> On Aug 13, 10:28am, DervishD wrote:
> } > I still recommend "print -rN" here.
> }     Why? Just in case some file has a '\' sequence in its name, a
> } quote or something like that?
> Yep.

    OK. I finally used this solution, but added an option to the
script so I can use '\0' or '\n' as the separator, and after that
I've setup an alias:

    myalias='reply=( ${(f)"$(script)"} ) ; print -l $reply'

    This way I can use 'reply' for storing the list of files when the
shell is interactive, and if I use 'script' within another script, I
just write the above. I can use the script with the option of using
NULL's as separator and pipe the output thru 'xargs' or the like.

    Thanks a lot for your invaluable help, Bart :))

    In case anyone is interested, the script shuffles a list of MP3
files and chooses a set to fit some given size (for example, the
space available in your MP3 player, a 74minutes CD, etc. I had it
implemented as a couple of shell functions, but I needed to make it
an script, that's why I made so much noise in the list.

    I'm going to release under GPL this and a few other scripts in
some weeks, just in case someone wants to take a look. There is very
good code in the scripts, but almost all of them came from the mind
of Bart, so please bother him with the acknowledgements XDD

    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