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

Re: ./pkg-search.sh: 2: ./pkg-search.sh: Bad substitution in a shell script -



shirish शिरीष wrote on Tue, May 09, 2017 at 02:28:15 +0530:
> ─[$] cat pkg-search.sh
>      1	for file in /usr/share/doc/*/changelog.Debian.gz; do
>      2	    package=${file:15}

> Trying to run the script under zsh I get the following -
> 
> [$] ./pkg-search.sh
> ./pkg-search.sh: 2: ./pkg-search.sh: Bad substitution

That runs the script under sh.  To run it under zsh, add

    #!/usr/bin/env zsh

as the first line of the script.





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