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

Re: sourcing a sh file in zsh



where that line reads:
[ "$a_root" = "" ] && a_root=/some/dir

richih@titanium ~ % zsh -f
titanium% echo $ZSH_VERSION
4.3.9
titanium% echo '[ "$a_root" = "" ] && a_root=/some/dir' > foo
titanium% source foo
titanium%


Can you try to reduce the script to a minimal test case which
still fails, please?

Yes, sorry, not enough debugging on my side.

It turns out the error is indeed not in line #1, but a bit later:

  a_temp=`egrep "^[  ]*$a_host[    ]" "$a_root/somefile"`

If I change that line to

  a_temp=`egrep "^[  ]*${a_host}[    ]" "$a_root/somefile"`

the script passes fine, with exit code 0.

So perhaps sh/bash are more lenient towards the use of braces in variables. At least a quick'n'dirty test script shows this.
I don't know; anyway can comment on that?



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