why I can't run this executable file?


Recommended Posts

Hi,

I did the "chmod +x filename" thing before I run this executable file, but all I got is

"bush: filename: command not found"

Why?

Do I have edit some other files to achieve this or just simply I did it wrong?

thank you.

Link to comment
Share on other sites

What program are you trying to run? A little more info would be helpful.

It's a script file written by other people, and is used to run some sorts of java programs.

Link to comment
Share on other sites

OH, so up there in your first post it wasnt "bush: filename" it was "bash: filename"

:laugh:

well, try:

./filename

and replace filename with the name of the executable you're trying to run. It could be becasue you dont have .; in your path.

Link to comment
Share on other sites

OH, so up there in your first post it wasnt "bush: filename" it was "bash: filename"

:laugh:

well, try:

./filename

and replace filename with the name of the executable you're trying to run. It could be becasue you dont have .; in your path.

oh, sorry about that stupid typing mistake :blush:

yeah, I tried "./filename" format, but it seemed it only worked with the executable file without command line.

however, the one Im trying to get it work is based on command line input (e.g. filename -x)

so it didn't work in that way, unfortunately.

em .... you just mentioned I don't have .; in my path, what's that? I suppose it would be helpful to my problem?!

thank you.

Link to comment
Share on other sites

If you want to put it in your path just make a directory named bin in your home directory. Then move the file there. Most distros put ~/bin in to $PATH. Then you can run the file from anywhere. If ~/bin isn't in your path, I'll tell how to add it.

Link to comment
Share on other sites

Well, . in your path makes the current directory in your path basically so you don't have to put ./ on it to run it. ./filename -x should work though.

I tried, but it says this time: "bash: /directory.../filename: /usr/local/bin/bash: bad interpreter: No such file or directory"

but the file without command argument works.

thank you.

Link to comment
Share on other sites

If you want to put it in your path just make a directory named bin in your home directory. Then move the file there. Most distros put ~/bin in to $PATH. Then you can run the file from anywhere. If ~/bin isn't in your path, I'll tell how to add it.

thanks, I will try and let you know what happen then.

Link to comment
Share on other sites

If you want to put it in your path just make a directory named bin in your home directory. Then move the file there. Most distros put ~/bin in to $PATH. Then you can run the file from anywhere. If ~/bin isn't in your path, I'll tell how to add it.

nah, it works for the files with no command argument, but still not works with the command line argument file.

it says: "bash: /directory.../bin/filename: /usr/local/bin/bash: bad interpreter: No such file or directory"

Another thing perhaps deserved to be mentioned is the file I cannot get it work is a shell script.

thank you.

Link to comment
Share on other sites

This is a shell script right?

EDIT: Yup, sorry - didn't read your post carefully enough.

if so try "whereis bash" to find out the location of bash. then change the first line from "#!/usr/local/bin/bash" to "#!/bin/bash" or whatever the location of bash is.

example:

(evn@evnbook:evn)$ ./script.sh
-bash: ./script.sh: /usr/local/bin/bash: bad interpreter: No such file or directory
(evn@evnbook:evn)$ whereis bash
/bin/bash
(evn@evnbook:evn)$ cat script.sh
#!/usr/local/bin/bash
echo "script works"

(evn@evnbook:evn)$ emacs script.sh 
(evn@evnbook:evn)$ cat script.sh
#!/bin/bash
echo "script works"

(evn@evnbook:evn)$ ./script.sh
script works
(evn@evnbook:evn)$

Link to comment
Share on other sites

run this command:

export PATH=$PATH;.;

That'll add your current directory to the path.

GAH! : are path separators. ; is for Windows.

Link to comment
Share on other sites

GAH! : are path separators. ; is for Windows.

:pinch: :pinch: :pinch:

I tell you, I edited that line back and fourth about five times between : and ; before finally deciding to leave it at ;.. Sorry :laugh:

Link to comment
Share on other sites

This is a shell script right?

EDIT: Yup, sorry - didn't read your post carefully enough.

if so try "whereis bash" to find out the location of bash. then change the first line from "#!/usr/local/bin/bash" to "#!/bin/bash" or whatever the location of bash is.

example:

(evn@evnbook:evn)$ ./script.sh
-bash: ./script.sh: /usr/local/bin/bash: bad interpreter: No such file or directory
(evn@evnbook:evn)$ whereis bash
/bin/bash
(evn@evnbook:evn)$ cat script.sh
#!/usr/local/bin/bash
echo "script works"

(evn@evnbook:evn)$ emacs script.sh 
(evn@evnbook:evn)$ cat script.sh
#!/bin/bash
echo "script works"

(evn@evnbook:evn)$ ./script.sh
script works
(evn@evnbook:evn)$

i believe this to be your fix here

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.