Hey Jeff,

On Thu, Jan 08, 2004 at 05:39:45PM +1100, Jeff Waugh wrote:
> But what does it actually do? Simple answer: When you execute the script (it
> must have the +x bits on), the contents of the file are piped into the bang
> path program, in this case, /bin/sh. So, let's put just the last two lines

This is not 100% correct. The hash-bang program is actually executed
with the path name of the script appended to it, as opposed to its
contents being piped into the hash-bang program. You can test this by
compiling this little C program...

    #include <stdio.h>

    int main(int argc, char **argv) {
    int i;

            for (i = 0; i < argc; ++i)
                 printf("argv[%d] = '%s'\n", i, argv[i]);
            return 0;
    }

...and making it the hash-bang program for a file. chmod +x it, then
execute the file.

This is why '#!/usr/bin/screen -c' works; the name of the file is passed
as the last argument to screen.

Regards,
Alec

--
Evolution: Taking care of those too stupid to take care of themselves.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to