28 Mar
2010
28 Mar
'10
8:03 p.m.
On Sun, Mar 28, 2010 at 8:18 AM, Florian Pritz <bluewind@server-speed.net> wrote:
On 28.03.2010 14:27, Allan McRae wrote:
On 28/03/10 22:12, Dieter Plaetinck wrote:
Hi Allan,
can't we use shebangs instead of inventing our own which-shell-to-use implementation? (#!/bin/sh, #!/bin/bash, ..)
No we can not unless I am missing something. We need to source the script and run a particular function within that script.
head -n1 installscript | grep '^#!/.*$'
Or: #define BUFSIZ 1024 int bufsiz = BUFSIZ; char buffer[BUFSIZ+1]; int fd = open(scriptlet, O_RDONLY); int bytes = getline(&buffer, &bufsiz, fd); if(buffer[0] == '#' && buffer[1] == '!') { char *shell = strdup(buffer+2); .... }