The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-27-2003
yls177
Guest
 

Posts: n/a
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
Forum Sponsor
  #2  
Old 03-27-2003
s93366's Avatar
Registered User
 

Join Date: Apr 2002
Location: Sweden
Posts: 159
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
yls177
Guest
 

Posts: n/a
in myfilename.sh, the first line is #!/bin/csh
  #4  
Old 03-27-2003
oombera's Avatar
Registered User
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
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
s93366's Avatar
Registered User
 

Join Date: Apr 2002
Location: Sweden
Posts: 159
and does /bin/csh exist on you system??

check it out!

/Peter
  #6  
Old 04-04-2003
Kelam_Magnus's Avatar
Registered User
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
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.
__________________
My brain is your brain
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0