Zsh
From raju
Subpages under zsh
shebang in shell scripts
A portable way to write shebang in zsh scripts is
#! /usr/bin/env zsh
The space between #! and /usr/bin/env is optional. But I like it since it is easy to see the interpreter that way.
For perl scripts, debian-policy [2] -> section 10.4 requires
#!/usr/bin/perl
Ref:
- [1] - https://en.wikipedia.org/wiki/Shebang_%28Unix%29
- [2] - https://www.debian.org/doc/debian-policy/ch-files.html#scripts
glob expansion in for loop
Do not use quotes if you want the expression to be expanded using wildcards. So the correct way is
for fname in foo.???????? do echo "$fname" done
The following will not expand the glob
for fname in "foo.????????" do echo "$fname" done
Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \
Ref:- https://superuser.com/questions/318738/does-a-wildcard-inside-double-quotes-glob