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

Re: EXEC peculiarities



>> I am a recent convert from Bash, and I'm confused about the behavior of
>> the 'exec' builtin. (zsh 4.2.0 on Linux)
>>
>> #! /bin/bash
>> EXEC='/sbin/ifconfig eth0'
>> exec $EXEC
>>
>> returns the expected output; the configuration of eth0
>>
>> #! /bin/zsh
>> EXEC='/sbin/ifconfig eth0'
>> exec $EXEC
>>
>> returns: "no such file or directory: /sbin/ifconfig eth0"
>
> The exec builtin has nothing to do with this.
>
> http://zsh.sunsite.dk/FAQ/zshfaq03.html#l17

Ok. So in the following examples, would the 1st form; ${(s: :)EXEC}; be
preferred, since the documentation says using the 2nd form; ${=EXEC};
forces SH_WORD_SPLIT on; potentially leading to unexpected behavior later?

#! /bin/zsh
EXEC='/sbin/ifconfig eth0'
EXEC=(${(s: :)EXEC})
exec $EXEC

#! /bin/zsh
EXEC='/sbin/ifconfig eth0'
EXEC=(${=EXEC})
exec $EXEC




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