difference in calling shell scripts


 
Thread Tools Search this Thread
Operating Systems Solaris difference in calling shell scripts
# 1  
Old 10-29-2007
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  
Old 10-29-2007
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  
Old 10-29-2007
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  
Old 10-29-2007
Try adding

Code:
#!/bin/sh

as the first line, or which ever shell you want to run it under.
# 5  
Old 10-30-2007
Thanx a lot porter...
Problem solved.
# 6  
Old 09-07-2008
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  
Old 09-07-2008
Quote:
Originally Posted by ksailesh
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

2. Shell Programming and Scripting

Difference between kshell and bash shell scripts Example cited

Hi All, I need some urgent help regarding some info. I have a cluster of servers for which I have two scripts for management. control.sh is a bash script meant for restarting/stopping the servers. manger.ksh is a kshell script. It is a master script to manage restarting/stoppping and... (3 Replies)
Discussion started by: ankur328
3 Replies

3. Shell Programming and Scripting

Calling oracle package Unix from shell scripts.

Hi, Can anyone tell me how to call a oracle package from a Unix shell script? I want to pass some input parameters to package and it will return me the output which I want to use further in my shell script. I want to know the way to capture the output values in my shell script. Please send some... (1 Reply)
Discussion started by: anil029
1 Replies

4. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

5. Shell Programming and Scripting

Calling scripts within script

Hi, I have written a some six scripts to move large files and re-size them. This has been done step by step, taking backup, creating the new files, merging the files, removing the temporary files created. Since these files are around 500 MB, each step takes somewhere between 1 to 5 mins. ... (1 Reply)
Discussion started by: baanprog
1 Replies

6. Shell Programming and Scripting

Difference between calling the sub scripts

What is the difference between calling the sub scripts of below two line. /home/scripts/devdb.sh . /home/scripts/devdb.sh sh /home/scripts/devdb.sh We are using the suse 2.0 version (4 Replies)
Discussion started by: kingganesh04
4 Replies

7. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

8. Shell Programming and Scripting

Calling SQL scripts through Shell Script

Oracle and Scripting gurus, I need some help with this script... I am trying to add the query SELECT * FROM ALL_SYNONYMS WHERE SYNONYM_NAME = 'METADATA' in the current script.... Read the result set and look for the TABLE_NAME field. If the field is pointing to one table eg.... (18 Replies)
Discussion started by: madhunk
18 Replies

9. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

10. UNIX for Dummies Questions & Answers

Difference in Shell Scripts

Hi, Is anyone can help me to find out the difference in Shell Scripts between HP and Sun. Thanks in advance, Vijay R (3 Replies)
Discussion started by: rv_kumar
3 Replies
Login or Register to Ask a Question