help required running a script (pretty please)
Most likely dumb but: have written a simple script (script1) I want to run i've used chmod +x script1 ro make it executable when I attempt to run it i get the error: "sh: ./script1: No such file or directory I'm logged in as root, I can see and edit it, Why can't i run it????????? as i said most likeley dumb but..... thanks in advance scsijon
On Thu, May 03, 2001 at 09:32:11PM +1000, scsijon wrote:
i've used chmod +x script1 ro make it executable
when I attempt to run it i get the error:
"sh: ./script1: No such file or directory
Did you put '#!/bin/bash' as the first line? Let us see the script. Regards, Cees.
its your path. the shell can't find the script. either launch it like this: ./script1 or add . to your path in bash: export PATH=.:$PATH /usr/bin/hash - /usr/bin is the Solaris location. not sure about linux location in csh set path=( . $path ) rehash (hash and rehash force OS to re-evaluate the internal directory tables.) Then try the script again -----Original Message----- From: scsijon [mailto:scsijon@net2000.com.au] Sent: Thursday, May 03, 2001 4:32 AM To: suse Subject: [SLE] help required running a script (pretty please) Most likely dumb but: have written a simple script (script1) I want to run i've used chmod +x script1 ro make it executable when I attempt to run it i get the error: "sh: ./script1: No such file or directory I'm logged in as root, I can see and edit it, Why can't i run it????????? as i said most likeley dumb but..... thanks in advance scsijon -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
Today, jennifer moter wrote... Hi,
its your path. the shell can't find the script. either launch it like this: ./script1 or add . to your path
i've used chmod +x script1 ro make it executable
when I attempt to run it i get the error:
"sh: ./script1: No such file or directory
it seens the loader can't find the interpreter for the script... does it have a #!/bin/bash or something like that (the correct interpreter for your script's language) in the first line ? Regards, Adilson Ribeiro
thanks to all that replied, especially jennifer moter, I knew it had to be simple but...... fyi the problem was fixed when I added the "export PATH=.:$PATH" statement mentioned by jennifer inside the script itself. Darned if I know why as my default path statement includes a "." but at least it works now. scsijon
On 03-May-01 scsijon wrote:
Most likely dumb but:
have written a simple script (script1) I want to run
i've used chmod +x script1 ro make it executable
when I attempt to run it i get the error:
"sh: ./script1: No such file or directory
Contrary to what the message appears to mean (and contrary to
other replies to this query), what this message really means
is that some file (data or program or ... ) referenced in the
script cannot be found.
This could basically be for three reasons (assuming the file
really exists somewhere): you have given an explicit path and
this is incorrect; you have just given the filename assuming
it is in the $PATH which the script is using, and it isn't;
or finding the file depends on the script knowing the value
of an environment variable which either has not been set
correctly or has not been exported to the script.
You will have to look through the script in detail to find
out where the problem is.
I find it is worth while giving full paths for all files and
programs referenced in scripts. That way you avoid depending
on assumptions which may not be true every time.
Good luck,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding)
Today, Ted.Harding@nessie.mcc.ac.uk wrote...
On 03-May-01 scsijon wrote:
Most likely dumb but:
have written a simple script (script1) I want to run
i've used chmod +x script1 ro make it executable
when I attempt to run it i get the error:
"sh: ./script1: No such file or directory
Contrary to what the message appears to mean (and contrary to other replies to this query), what this message really means is that some file (data or program or ... ) referenced in the script cannot be found.
hi, i just tried this $ cat > test.sh #!/bin/bashh # ^^^^^^^^^^ let's say I wrote the name of the # script interpreter incorrectly clear ^D $ chmod +x test.sh $ ./teste.sh bash: ./teste.sh: No such file or directory bash is my shell. he can't find the script's interpreter. so, he can't execute the file Regards, Adislon Ribeiro
Test is not a good name for your program. test is a native program which compares values, you must call it somethng else all you need to do is chmod +x mytest then prompt> mytest eg [mytest] echo hello world chmod +x mytest prompt> mytest thats it, you dont need shell...The shell knows how to interpert a simple script very simple also... you dont need the file extension for example you could call it mytest.tyrfgethyujjj but you would have to type that every time just mytest is sufficient rob
$ cat > test.sh #!/bin/bashh # ^^^^^^^^^^ let's say I wrote the name of the # script interpreter incorrectly clear ^D $ chmod +x test.sh $ ./teste.sh bash: ./teste.sh: No such file or directory
bash is my shell. he can't find the script's interpreter. so, he can't execute the file
Regards, Adislon Ribeiro
participants (6)
-
Adilson Guilherme Vasconcelos Ribeiro
-
Cees van de Griend
-
jennifer moter
-
rob
-
scsijon
-
Ted.Harding@nessie.mcc.ac.uk