Shell script execution methods


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell script execution methods
# 1  
Old 09-17-2011
Shell script execution methods

Hi,

Shell script can be executed in few ways. I would like to know the differences in the below execution methods.

sh file1.sh
. file1.sh
. /file1.sh

Please help, thank you.
# 2  
Old 09-17-2011
The first starts a new shell and executes the script in that shell. The second and third execute a script in the current shell (this is called "sourcing"). The first and second read a script from the current directory, the third reads a script from the root directory.
This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 09-17-2011
Thank a lot, this is helpful.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

2. Shell Programming and Scripting

Shell Script execution issues

Hi, There's a shell script by name "download", which has been created as user "mgr" and that script needs to executed as user "dev". I tried giving privileges 701 on the script download. But it's throwing the error message bin]$ ./download /bin/bash: ./download: Permission denied ... (6 Replies)
Discussion started by: venkatesh17
6 Replies

3. UNIX for Dummies Questions & Answers

shell script execution in ab initio

Hi All, How to execute shell script for running Ab initio graphs? Regards (0 Replies)
Discussion started by: eshalife
0 Replies

4. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

5. Shell Programming and Scripting

Execution problem with shell script

Hi all, I want to use perl string manipulation commands in my shell script. I have written following script. echo "enter name" read name perl -e '$m=length($name); echo $m it gives an error: unrecognized token in perl command line. do not suggest me an equivalent command of shell... (3 Replies)
Discussion started by: admc123
3 Replies

6. Shell Programming and Scripting

automatic execution of shell script

Dear All, I want to execute a shell script,whlie system is booting. I was try using /etc/rc.d/rc.local file but its not working. (1 Reply)
Discussion started by: rajamohan
1 Replies

7. Shell Programming and Scripting

Cron execution of shell script

Hi Guys, Unable to run this script from the cron,although the same executes perfectly from the command line.Please help. #!/bin/sh #### aprintd alarm creation files ##### file=`date +%m%d%Y` pid=$$ echo "$pid" /u01/app/netboss/bin/aprintd/aprintd > $file & childpid=$!... (3 Replies)
Discussion started by: ashish.sharma
3 Replies

8. Shell Programming and Scripting

problem with shell script execution

Hi All, i am running a shell script in which there is a command `ps -ef | grep smon > db` When i execute this command in the command prompt i am getting the desired output..but when the script is executed..the db file is getting created but with no values...I could not find the reason for... (2 Replies)
Discussion started by: anju
2 Replies

9. UNIX for Dummies Questions & Answers

Is there a way to tell how long does a shell script's execution take?

Is there a way to tell how long does a shell script(or a shell command)'s execution take? (4 Replies)
Discussion started by: meili100
4 Replies

10. Shell Programming and Scripting

execution of shell script

How can I execute another shell script from one? Malay (5 Replies)
Discussion started by: malaymaru
5 Replies
Login or Register to Ask a Question