-   Fedora (
-   -   Scripts failing with #!/bin/bash or other shell on first line (

rdfoerster 11-15-2004 01:29 PM

Scripts failing with #!/bin/bash or other shell on first line
Have several scripts that start with #!/bin/bash or #!/bin/php or somthing similar to set the shell for the script.

All of these scripts terminate immediatly when started from a prompt unless the shell is specified on the command line.

[root@nsse ~]# ./testme
[root@nsse ~]#

[root@nsse ~]# bash ./testme
Hello World
[root@nsse ~]#

The testme script is as follows:

echo "Hello World"

The platform is FC3

Other than this one issue everything is running fine.


mmmm 11-15-2004 02:19 PM

Are you sure bash and others are in /bin/ ?
You can check it by typing :
which bash

cryptwizard 11-16-2004 12:02 AM

Thats what I have.

wiraone 11-16-2004 01:16 AM

Your test script works just fine on my FC3. Did you do an upgrade from previous release?

GAVollink 11-16-2004 02:06 PM

No problems on my FC3 either.
I can save the file in DOS text mode, but then I get:
: bad interpreter: No such file or directory
I can save the file without Execute permission, but then I get:
bash: ./testme: Permission denied

I have no idea what you're doing.

rdfoerster 11-16-2004 04:33 PM

Another piece of information that I did not think was relavent at the time but found that it is. All of these scripts are being run from a prompt or cron but they are located under /var/www/html directories. The directories they are in are owned by and executed by the same user. Moved the scripts out of these directories and everything works.

benjithegreat98 11-16-2004 07:46 PM

Did you do this first: chmod +x testme
That makes the file an executable file.
If you do ls -l testme and you see -rw-rw-r-- then you have not set it as executable
If you see -rwxrwxr-x then you should be able to use ./testme to run the script.

All times are GMT -5. The time now is 05:41 AM.