Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Calling shell script within shell script Post 302846971 by Don Cragun on Monday 26th of August 2013 04:29:48 AM
Old 08-26-2013
Quote:
Originally Posted by baanprog
Hi All,

I have a simple script that has 8 more scripts being called within it.
Like below

Main Script.sh has within it like below
-----------------------

Code:
Script1.sh
Script2.sh
Script3.sh
Script4.sh
Script5.sh
Script6.sh
Script7.sh
Script8.sh

-----------------------------

Now I want 2 to run after 1 finishes and 3 after 2 and likewise until 8 as each script create a huge file which can take time to complete and it cannot be a fixed value(so cannot use sleep).

Please let me know will unix automatically wait for script 1 to finish for script 2 to start and so on

or

should I use (& and wait) combination to handle this.

Thanks
Your script as written above will not start Script2.sh until Script1.sh exits. As long as Script1.sh doesn't start anything asynchronously that hasn't completed before it exits; you will be fine.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calling dos2unix on shell script from within the script

I have a build script. It was created on Linux. For some reason, I got it to windows and modified it. And brought it back again to Linux. Since there is the question of the ^M chars appearing, the way out is to do a dos2unix on the script file. This is done manually. Is there a way to call... (4 Replies)
Discussion started by: vino
4 Replies

2. Shell Programming and Scripting

Calling shell functions from another shell script

Hi, I have a query .. i have 2 scripts say 1.sh and 2.sh 1.sh contains many functions written using shell scripts. 2.sh is a script which needs to call the functions definded in 1.sh function calls are with arguments. Can some one tell me how to call the functions from 2.sh? Thanks in... (6 Replies)
Discussion started by: jisha
6 Replies

3. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

4. Shell Programming and Scripting

Calling a shell script from a perl script

Hi, I have one shel script which returns some value and I am calling this shell script from a perl script which needs the out put/return value of shell script. But I don't know how to collect the output/return value of the shell script. Can any one give some idea on it? For example: The... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

5. 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

6. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

7. Shell Programming and Scripting

Error in calling a shell script from another script

HI, We are using two shell scripts, script.sh,env.sh, where env.sh will be called inside script.sh. The variable inside env.sh is used as $var in script.sh.But while running the script its not identifying that variable. Is there any permission needed to call a script inside another script. ... (3 Replies)
Discussion started by: banupriyat
3 Replies

8. Shell Programming and Scripting

How we can pass the argument when calling shell script from perl script

Can someone let me know how could I achieve this In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Discussion started by: anuragpgtgerman
5 Replies

9. Shell Programming and Scripting

calling a shell script present on another server using perl script.

Hi, I am working on a sever A. I want to write a perl script to execute a shell script persent on the server B. please help me in this. thanks in advance. (3 Replies)
Discussion started by: anandgodse
3 Replies

10. Shell Programming and Scripting

Calling shell script within awk script throws error

I am getting the following error while passing parameter to a shell script called within awk script. Any idea what's causing this issue and how to ix it ? Thanks sh: -c: line 0: syntax error near unexpected token `newline' sh: -c: line 0: `./billdatecalc.sh ... (10 Replies)
Discussion started by: Sudhakar333
10 Replies
SCSI_START(8)							     SG3_UTILS							     SCSI_START(8)

NAME
scsi_start - start one or more SCSI disks SYNOPSIS
scsi_start [--help] [--verbose] [--wait] DEVICE [DEVICE]* DESCRIPTION
This bash shell script calls the sg_start utility on each given DEVICE. The purpose is to spin up (start) each given DEVICE. OPTIONS
Arguments to long options are mandatory for short options as well. -h, --help print out the usage message then exit. -v, --verbose increase level or verbosity. -w, --wait wait for the spin up (start) on each given DEVICE to complete. The default action is to do each start in immediate mode. NOTES
If a large number of disks are spun up at the same time (i.e. without the --wait option) then the power supply may be overloaded. EXIT STATUS
The exit status of this script is 0 when it is successful. Otherwise the exit status is that of the last sg_start utility called. See the sg3_utils(8) man page. AUTHORS
Written by D. Gilbert COPYRIGHT
Copyright (C) 2009-2013 Douglas Gilbert This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_start (sg3_utils) sg3_utils-1.36 May 2013 SCSI_START(8)
All times are GMT -4. The time now is 08:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy