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

Re: variable problem



Thomas Ziehmer <ziehmer@xxxxxxxxxxxxxx> writes:

> I got into the following problem (only tested on zsh-3.1*)
> 
> thomas@digger [thomas]> a='echo x'
> thomas@digger [thomas]> echo $a
> echo x
> thomas@digger [thomas]> $a
> zsh: command not found: echo x
>  
> The correct output would be 'x'. I get the correct output in other shells
> (sh,ksh,bash).

No, you get the incorrect output in other shells.  This is the famous
SHWORDSPLIT issue mentioned in the FAQ (which says that all other
shells are broken).

If you use

        % a=(echo x)

instead, then things will work as you want.  Or setopt SHWORDSPLIT, or
use whatever magic it is to do SHWORDSPLIT on expansion (the $a line).



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