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

Re: script help



At 06:15 -0500 08 Dec 2012, shawn wilson <ag4ve.us@xxxxxxxxx> wrote:
this is in my .zshrc file and it fails to execute $cmd with:
vim:45: no such file or directory: /usr/local/bin/vim --servername SWILSON

Normally zsh doesn't split the result of variable expansion into separate words. You can enable that for your function by adding the following line to it:

setopt local_options sh_word_split

Enabling the local_options option will cause other options set within the function to be returned to their original state when the function returns. The sh_word_split option will cause the results of expanding your $cmd variable to be split into words before evaluating that line, allowing it to be used as you intended.

Another option would be to use ${=cmd} in place of just $cmd when you attempt to run that command. That will cause word splitting to be done in that case only.



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