Can't execute files that are executable

Can't execute files that are executable

Post by Georg » Sun, 31 Dec 1899 09:00:00



Hi everyone,

Can someone help this Linux newbie?  I can't execute files that should be
executable.  I've written (actually edited) some scripts, then make them
exectable by running "chmod +x filename".  But when I try to run the script
from a command prompt, I get "bash: filename: command not found."

The funny thing is, I can execute these from the Gnome file manager.

Why is this guys?  Thanks for any info.

George

 
 
 

Can't execute files that are executable

Post by Frederic Vivie » Sun, 31 Dec 1899 09:00:00



> Hi everyone,

> Can someone help this Linux newbie?  I can't execute files that should be
> executable.  I've written (actually edited) some scripts, then make them
> exectable by running "chmod +x filename".  But when I try to run the script
> from a command prompt, I get "bash: filename: command not found."

> The funny thing is, I can execute these from the Gnome file manager.

> Why is this guys?  Thanks for any info.

It's exactly what it says : it doesn't find the command. If you arre
in the directory the file is, instead of typing "filename" as a
command, type "./filename", "." being the nickname for the current
directory. Generally you can had the current directory to your search
path (e.g., under bash you can had the following line to your .bashrc
file : export PATH=$PATH:.).

More generally, the system can only start a command if it knows where
the corresponding executable file is. Its search list is defined by
the variable PATH. To see its content :
echo $PATH.

F.V.

 
 
 

Can't execute files that are executable

Post by lcs3.. » Sun, 31 Dec 1899 09:00:00




Quote:> Hi everyone,

> Can someone help this Linux newbie?  I can't execute files that should
be
> executable.  I've written (actually edited) some scripts, then make
them
> exectable by running "chmod +x filename".  But when I try to run the
script
> from a command prompt, I get "bash: filename: command not found."

> The funny thing is, I can execute these from the Gnome file manager.

> Why is this guys?  Thanks for any info.

> George

a couple of other possibilities (other than ./filename or adding .
to your path):

the first line of the script is something like '#!/usr/bin/bash' and
no /usr/bin/bash exists on your system.

The first line ends in a ^M (carriage return).  Delete all carriage
returns.

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

1. can't execute an executable file.....

I installed RedHat Linux 6.2 recently. When compiled and tried to execute a
simple C program, I got the following error - "bash: a.out: command not
found."

I compiled my HelloWorld program using gcc as follows: gcc simple.c (no
erros were reported)
Then, I checked a.out attributes, they were -rwxr-xr-x.

What can be wrong? Why doesn't it execute?

Please, help. TIA :)

2. rdist

3. executable files w/o using 'file'

4. Hi, i'm a newbie and I need help concerning the setup of Linux (slackware)

5. dual line modems

6. Executable Binary File vs. Executable Script File

7. Postscript dilemma

8. executable won't execute

9. using popen to execute and feed input to set of executable files

10. How do I write an executable 'batch' file

11. Can't execute binary files and file corruption?

12. Help:Only used source-files will be 'executed'