LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-07-2009, 09:10 PM   #1
onesikgypo
Member
 
Registered: Jun 2008
Posts: 56

Rep: Reputation: 15
Run an external script, without holding up the currently executing script


Hi,

If for example i have 2 custom bash scripts, the first bash script is for example:

Code:
#!/bin/bash

echo start
script2
script3
echo finished
and say, script2 is the following:

Code:
#!/bin/bash

a=1
while [ "$a" == "1" ]; do

code here

if [ "$x" == "$y" ]; then
a=2
else
sleep 60
fi

done
if i run the first script, it may take quite sometime for script2 to come to completion, and thus as a result script3 will not be executed for sometime (as i have to wait for script2 to finish first).

What i am wanting to do, is somehow execute script2 , without having to wait it to finish before script1 can continue and script3 can execute

Any assistance would be greatly appreciated.

Thankyou
 
Old 03-07-2009, 09:21 PM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Code:
#!/bin/bash

echo start
(script2 &)
script3
echo finished
or
Code:
#!/bin/bash

echo start
script2 &
script3
echo finished
 
Old 03-07-2009, 09:26 PM   #3
onesikgypo
Member
 
Registered: Jun 2008
Posts: 56

Original Poster
Rep: Reputation: 15
heh, seems like quite a simple solution, feel kind of stupid :P


Thanks for the help
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to run script on the server from client machine in windows in a perl script vpradeep Linux - Newbie 2 09-01-2008 03:29 AM
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 09:56 AM
How do I add external packages to my linux install and get it to run a script? michaelwl Linux - General 5 08-25-2006 03:15 AM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 05:05 PM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration