[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Can't get scripts to work



On Wed, Jan 05, 2000 at 11:29:44PM -0500, Wayne Topa wrote:
> > (Why does this work, by the way?
> > Is /bin/sh the default interpreter?)
> 
> I also thought this (Colin's comment), was the problem so I changed
> some of my bash scripts to test it.  At least on my slink box, that
> isn't the answer.  
> 
> All of these worked :  #!/bin/sh, # !/bin/sh, #! /bin/sh and
> the script even worked _without_ any #! line _at all_!!!   I have no
> idea why it worked, but it does?????

I read somewhere (although I can't find it now) that /bin/sh _is_ the
default interpreter for text files.  With that in mind, your second
example (# !/bin/sh) is not recognized as a shebang, it's passed off
to sh by default, and sh ignores the first line as a comment.

				 -Michael

-- 
  Michael Stenner			Office Phone: 919-660-2513
  Duke University, Dept. of Physics	  mstenner@phy.duke.edu
  Box 90305, Durham N.C. 27708-0305


Reply to: