The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem with shell script execution anju Shell Programming and Scripting 2 05-07-2008 10:50 PM
Scheduling the execution of a shell script sumesh.abraham Shell Programming and Scripting 1 12-06-2006 04:25 AM
Sequential execution of job in cron pankajkrmishra Shell Programming and Scripting 3 08-15-2006 02:19 AM
Reading special characters while converting sequential file to line sequential Rajeshsu High Level Programming 2 07-10-2006 11:38 AM
execution of shell script malaymaru Shell Programming and Scripting 5 06-13-2005 06:49 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-29-2007
Registered User
 

Join Date: Feb 2007
Posts: 30
Sequential execution in shell script?

I've a shell script that invokes a URL of an application to do some work, e.g., http://www.abc.com/myservlet?action=helloworld.Does the shell wait for a return value from the URL call before proceeding to the next line of command?
Reply With Quote
Forum Sponsor
  #2  
Old 03-29-2007
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 790
yes, unless you start a new thread and do the operation in the new thread independently. usually you won't be doing this in a shell script
Reply With Quote
  #3  
Old 03-29-2007
Registered User
 

Join Date: Feb 2007
Posts: 30
Quote:
Originally Posted by Yogesh Sawant
yes, unless you start a new thread and do the operation in the new thread independently. usually you won't be doing this in a shell script
So regardless of what's happening inside the URL call, the next line of command inside the SHELL script would not execute until the URL call ended?
Reply With Quote
  #4  
Old 03-29-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
If you are specific to make a call to specific operation and still continue with the next set of lines in the script
it is usually done with an ' & '
Code:
instruction1 &
instruction2 &
instruction3
Reply With Quote
  #5  
Old 03-29-2007
Registered User
 

Join Date: Feb 2007
Posts: 30
Actually I want the current line to finish executing before continuing to the next line. So do I still use the '&"?
Reply With Quote
  #6  
Old 03-29-2007
dj -------
 

Join Date: Feb 2007
Location: Cochin/Bangalore, India
Posts: 418
Quote:
Originally Posted by chengwei
Actually I want the current line to finish executing before continuing to the next line. So do I still use the '&"?
Unix has a sequential approch in executing the commands unless they are made to run in the background(using & as given in above posts.). ie,

command1
command2
command3

will be executed as command1 followed by command2 followed by command3 irrspective of the outcome of the commands.


If you want to run command2 only if command1 is executed fine and similarly command3 only if command2 is executed, you can do like..

command1 && commmand2 && command3
Reply With Quote
  #7  
Old 03-29-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
Quote:
Originally Posted by chengwei
Actually I want the current line to finish executing before continuing to the next line. So do I still use the '&"?

No you dont have to,

current instruction
next instruction
next + 1 instruction

for the above instruction order, for a sequential flow only if the current instruction is completed executing, control would flow to the next instruction
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0