From: utzoo!decvax!cca!hplabs!hao!menlo70!sytek!gi!arizona!whm@sri-unix Newsgroups: net.unix-wizards Title: Re: #! /bin/foo Article-I.D.: arizona.1192 Posted: Sun Oct 31 02:18:49 1982 Received: Wed Nov 10 02:31:03 1982 Using the #! mechanism does not work with every command interpreter. If you start a file with #! /bin/foo, and make the file executable, running the file will cause /bin/foo to started up with the file as standard input. If /bin/foo doesn't know what to do with a line of the form, #! ..., it's trouble. I presume that make and awk work because they use # as a comment character. This mechanism is extremely powerful and useful, I'm surprised that nobody has done it before now. I guess a ramification of this is that # is being locked in as a "global" comment character for programs that interpret scripts. It also should be pointed out that #! need not only be used with ascii text files, it can be used with "binary" files as well. I used this feature to make files produced by our Icon interpreter translator directly executable. Thus, instead of having to say "iconx program-name", you just say "program-name". I was going to say that Berkeley Pascal should use this as well, but I see that "obj" files produced by pi are "executable", although they don't use the "#!" mechanism. For enlightenment, try: cat >xtest #! /bin/cat This is it. ^D chmod +x xtest xtest It's also fun to try "adb xtest".