3 ms·
Technically 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 s
by procaryote 1y ago
Technically 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)