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

Re: zsh will not run scripts as /bin/bash even with #!/bin/bash as the first line



On Sat, Nov 24, 2012 at 8:07 PM, John <da_audiophile@xxxxxxxxx> wrote:
> Been using zsh for a while now and loving it.  I ran into a problem today.  The following script errors out if run with zsh as my default shell:
>
> #!/bin/bash
> v_build() {
>
> echo "The file is $1"
> }
>
> export -f v_build
> find . -maxdepth 1 -type f | parallel v_build
>
> Output:
> % ./test
> zsh:1: command not found: v_build
> zsh:1: command not found: v_build
> zsh:1: command not found: v_build
> zsh:1: command not found: v_build

Ur main script is indeed run by bash but parallel is trying to execute
the v_build command in your default shell.... therefore it has nothing
to do with the #! line...

Not sure how to solve this problem though....

>
> If I switch to a user who has bash as its default shell, the same script runs just fine:
>
> $ ./test
> The file is ./test
> The file is ./01.jpg
> The file is ./02.jpg
> The file is ./03.jpg
>
> Love to understand what I have incorrectly configured.  It seems like zsh is ignoring the shebang telling it to use /bin/bash as the shell to run the script.



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