sh or ./


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sh or ./
# 1  
Old 03-27-2003
sh or ./

permission of a filename.sh is -rwxr-xr-x


./filename.sh -> command not found

sh filename.sh -> then success...

why is that so?
i suspect is the -rwxr-xr-x
yls177
# 2  
Old 03-27-2003
in filename.sh check that the #! line points to sh

the #! tells what program to execute the script with...

if the path is wrong to sh simply change it to where sh is on your system..


/Peter
# 3  
Old 03-27-2003
in myfilename.sh, the first line is #!/bin/csh
yls177
# 4  
Old 03-27-2003
for Bourne Shell:

#!/bin/sh

for C-Shell:

#!/bin/csh

for Korn Shell:

#!/bin/ksh

for Perl:

#!/usr/um/bin/perl
# 5  
Old 03-28-2003
and does /bin/csh exist on you system??

check it out!

/Peter
# 6  
Old 04-04-2003
Yls177,

The reason that the "sh filename.sh " works is because you are invoking the bourne shell. Remember "sh" is actually a command. Read the man on sh.

When you use ./filename.sh, You are trying to execute the file in the current directory using its internal scripting. You must have the shell you are invoking inside the script, in the /etc/shells file. If not your script will fail.
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question