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

Re: for loop with parameter expansion in zsh vs. bash



Hello

2015-11-03 8:13 GMT+01:00 lilydjwg <lilydjwg@xxxxxxxxx>:


>
> % for e in ${=PATH//:/ }; do echo e: $e; done
>

​That's easy enough to type and remember, even for me ;)​



>
> zsh has sh_word_split option unset by default, so use ${=var} to request
> word splitting explicitely.
>
> I like this behaviour very much, because I don't need to quote nearly
> every variable :-)
>

​Thanks a lot. Might get used to it as well *G*​




>
> PS: there is a coresponding $path array, and you can tie your own
> variables like this:
>





>
> export -TU PYTHONPATH pythonpath 2>/dev/null
>
> Re-tying a variable fails for zsh 4.x so I have to redirect the error
> message to the black hole. And '-U' is for uniq to remove duplicates.
>


​Cool. Thanks ;)​


​Cheers,

Alexander
-- 
=>        *Google+* => http://plus.skwar.me         <==
=> *Chat* (Jabber/Google Talk) => a.skwar@xxxxxxxxx <==


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