[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sequence of execution within a script

Posted on 2011-10-14
6
Medium Priority
?
270 Views
Last Modified: 2012-05-12
I have a script, MyScript, as follows:

#!/bin/sh/
./SubScriptA
echo 'Sub script A completed'
./SubScriptB
echo 'Sub script B completed'
exit

I'll be executing the script as:
nohup ./MyScript  &

Questions:
1) Will SubScriptB wait till SubScriptA is completely finished?
2) Is the execution sequential, i.e., line 1 executes then line 2 and so on?
3) Anything you would suggest to make it better?

Thanks.
0
Comment
Question by:soccerplayer
6 Comments
 
LVL 11

Accepted Solution

by:
maeltar earned 1000 total points
ID: 36972445
Yes the script is sequential, and looking at the flow you have got thats the only way to do it.
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 1000 total points
ID: 36972463
Unless you run a process in the background, all the steps will be sequential.

0
 

Author Comment

by:soccerplayer
ID: 36973262
I am running the main script MyScript in the background. Will the children script be sequential?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:soccerplayer
ID: 36973265
I meant, will running MyScript in the background affect anything?
0
 
LVL 48

Expert Comment

by:Tintin
ID: 36974098
Running MyScript in the background won't affect the sequence of the commands inside that script.
0
 
LVL 85

Expert Comment

by:ozo
ID: 36976345
3) Anything you would suggest to make it better?
By what measure of goodness?
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question