4 ms·
Similarly, make go source executable : https://unix.stackexchange.com/questions/162531/shebang-starting-with https://unix.stackexchange.com/questions/162531/she
by emmelaich 2y ago
Similarly, make go source executable : https://unix.stackexchange.com/questions/162531/shebang-starting-with https://unix.stackexchange.com/questions/162531/shebang-star...
also, my contribution, make C programs executable:
$ cat cute-use-of-slash-slash.c
//usr/bin/env sh -c 'p=$(expr '"_$0"' : "_\(.*\)\.[^.]*"); make $p > /dev/null && $p'; exit
#include <stdio.h>
int main()
{
puts("hello world");
}
$ chmod +x cute-use-of-slash-slash.c
$ ./cute-use-of-slash-slash.c
hello world
$ $(pwd)/cute-use-of-slash-slash.c
hello world
$ ../cc/cute-use-of-slash-slash.c
hello world
$ sed -i -e s/hello/bye/ cute-use-of-slash-slash.c
$ ./cute-use-of-slash-slash.c
bye world
$