Subject: Re: Can't get scripts to work
        Date: Thu, Jan 06, 2000 at 02:54:20AM +0000

In reply to:Colin Watson

Quoting Colin Watson([EMAIL PROTECTED]):
>| [EMAIL PROTECTED] (Cameron Matheson) wrote:
>| >I can't get any of my scripts to work.  I'm just trying to start simple, by
>| >making a script to delete all my FreeCiv save files.  I use 'vi' and type
>| >the following:
>| >
>| >           # !/bin/sh
>| >           rm civgame*
>| >           clear
>| >           pwd
>| >           ls -l
>| >
>| >Then I type "chmod u+x removeCiv.sh" to add execute permission to myself,
>| >but when i type "removeCiv.sh" at the prompt i get the error "bash:
>| >removeCiv.sh: command not found"
>| >
>| >How do I get my scripts to work?
>| 
>| As well as what's already been mentioned, you should use '#! /bin/sh',
>| not '# !/bin/sh'; the difference is significant to the kernel, which
>| uses the shebang (#!) to start up the "executable interpreter" mechanism
>| for scripts. '#!/bin/sh' will also work on Linux, but I believe other
>| Unices (BSD?) use '#! /' as the executable interpreter marker, so
>| '#! /bin/sh' is safer.
>| 
>| It happens that your script would work in this case, but not if you
>| moved to some other language like Perl. (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?????

slink, 2.2.13.
-- 
For any problem there is a solution that is simple, quick, and
ultimately worse than the problem.
_______________________________________________________

Reply via email to