Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!jms From: jms@cs.vu.nl (Jan-Mark) Newsgroups: comp.os.minix Subject: Re: test/[ solved; new question: executable scripts? Summary: To some kernels #! is a magic number. Message-ID: <9818@star.cs.vu.nl> Date: 29 Apr 91 22:45:45 GMT References: <1991Apr29.110459.25477@doe.utoronto.ca> Sender: news@cs.vu.nl Reply-To: jms@cs.vu.nl (Jan-Mark Wams) Organization: VU Dept. of Computer Science, Amsterdam, The Netherlands Lines: 39 In article <1991Apr29.110459.25477@doe.utoronto.ca>, david@doe.utoronto.ca (David Megginson) writes: #> #> Thank you to every one who sent me mail. The solution to using the #> #> if [ ] #> #> syntax in sh is to link test to [. test is even smart enough that it #> looks for the ] if it is called as [. #> #> I am also interested in executable scripts. Right now, when I make a #> script executable, the kernel always seems to presume that it is for #> sh. I would like to have executable scripts like #> #> #! /usr/gnu/bin/gawk #> #> BEGIN { print "hello" } #> #> /bug/ { print "Oh no!" } #> #> END { print "bye" } #> #> If this script were called "buggy", and I chmod'd it to make it #> executable, I would expect it to run under gawk, but the kernel still #> gives it to sh (can't find BEGIN...). Any advice, or is this another #> incredible dumb question? To some kernels #! is a magicnumber. If a file has #! as first two bytes, the rest of the line is put into an array and used in an ``system ()'' call. So hack the kernel is you want this! But are you sure you DO want this, remember; small is ..... Jan-Mark. -- (:> jms (_) ========""======