3 ms·
A shell script has to start with "#!" with no spaces before it. I spent about a week figuring that out 25+ years ago.
by thebeardisred 1y ago
A shell script has to start with "#!" with no spaces before it. I spent about a week figuring that out 25+ years ago.
- ramses0 1y agoSimilarly, it's `XXX=123`, and cannot be `XXX = 123` or `$XXX=123`. Shellcheck (and Wooledge) are crucial!
- procaryote 1y agoTechnically it doesn't... If you drop echo "hello world" into a file and chmod +x it, it will run with /bin/sh You technically only need the shebang to set a specific shell, or options. ... This little quirk allows you to commit crimes like: //usr/bin/cc -o ${o=$(mktemp)} "$0" && exec -a "$0" "$o" "$@" #include <stdio.h> int main(void){ printf("hello world\n"); return 0; } which will autocompile and run on execution. (don't)