The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
any possible solution on sql calling scripts manas_ranjan Shell Programming and Scripting 4 11-22-2007 06:02 AM
Calling SQL LDR and SQL plus scripts in a shell script rajagavini Shell Programming and Scripting 5 11-05-2007 06:12 PM
Calling SQL scripts through Shell Script madhunk Shell Programming and Scripting 18 06-14-2006 12:35 PM
Difference between writing Unix Shell script and AIX Shell Scripts haroonec AIX 0 04-12-2006 02:27 AM
Difference in Shell Scripts rv_kumar UNIX for Dummies Questions & Answers 3 04-27-2005 10:16 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1 (permalink)  
Old 10-29-2007
arpit_narula arpit_narula is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
difference in calling shell scripts

Hi
I am getting some errors when i am running the shell script using the following syntax:
>abc.sh

but the same script works fine with the following syntax:
>sh abc.sh

wats the difference in both....please help
thanks in advance.
  #2 (permalink)  
Old 10-29-2007
samplify samplify is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 4
Solution

you need to give permission to the script to make it running without prefixing it with a 'sh' or '.'

try
$ chmod 777 abc.sh
$ abc.sh
  #3 (permalink)  
Old 10-29-2007
arpit_narula arpit_narula is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
thanks for the prompt response...
But i don't think changing the permissions will solve the problem coz script is running without the prefix but it is giving error that its not recognising the symbol "!" used in if condition.
  #4 (permalink)  
Old 10-29-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Try adding

Code:
#!/bin/sh
as the first line, or which ever shell you want to run it under.
  #5 (permalink)  
Old 10-30-2007
arpit_narula arpit_narula is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
Thanx a lot porter...
Problem solved.
  #6 (permalink)  
Old 09-07-2008
ksailesh ksailesh is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 11
sh abc.sh two things it will do
1) it need execute permissions which ./abc.sh doent require
2)it gets invoke in new shell hereas ./abc.sh executes in tht shell only.
  #7 (permalink)  
Old 09-07-2008
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,387
Quote:
Originally Posted by ksailesh View Post
sh abc.sh two things it will do
1) it need execute permissions which ./abc.sh doent require
That's the other way around.
Quote:
2)it gets invoke in new shell hereas ./abc.sh executes in tht shell only.
This is incorrect too, both launch a new shell.

I guess you are confusing ./abc.sh with . ./abc.sh, nothing that worth awaking a one year's old thread.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0