what is this doing ? (bakcground execution)

what is this doing ? (bakcground execution)

Post by johnn » Wed, 28 Jun 2006 06:23:56



What are differences on this sentences of Unix programas executuions ?

a) program1;program2;program3
b) program1;program2;program3 &
c) (program1;program2;program3) &

I think a) starts to execute command1. When command1 finishes, starts
programa2. When programa2 finishes, starts program3.

I think b) is same as a), except program 3 is executed in background.

I think c) executes program1 in background. When program1 finishes it
executes program 2 in background. When program2 finishes it starts
program3 in background.

Correct ?

 
 
 

what is this doing ? (bakcground execution)

Post by Kevin Collin » Wed, 28 Jun 2006 06:50:47



> What are differences on this sentences of Unix programas executuions ?

> a) program1;program2;program3
> b) program1;program2;program3 &
> c) (program1;program2;program3) &

> I think a) starts to execute command1. When command1 finishes, starts
> programa2. When programa2 finishes, starts program3.

> I think b) is same as a), except program 3 is executed in background.

> I think c) executes program1 in background. When program1 finishes it
> executes program 2 in background. When program2 finishes it starts
> program3 in background.

> Correct ?

Mostly. In "c" you are starting a subshell "( ... )" in the background "&".
Within that subshell, will run program1, then program2, then program3
sequentially. Basically, this is the same as "a", but in a different subshell.

Kevin

--
Unix Guy Consulting, LLC
Unix and Linux Automation, Shell, Perl and CGI scripting
http://www.unix-guy.com

 
 
 

what is this doing ? (bakcground execution)

Post by base6 » Wed, 28 Jun 2006 08:08:15



> What are differences on this sentences of Unix programas executuions ?

> a) program1;program2;program3

Runs the three consecutively.

Quote:> b) program1;program2;program3 &

Runs the three consecutively, but backgrounds the last.

Quote:> c) (program1;program2;program3) &

Runs the three consecutively from a subshell --
same as the first with more busy work.
Quote:

> I think a) starts to execute command1. When command1 finishes, starts
> programa2. When programa2 finishes, starts program3.

> I think b) is same as a), except program 3 is executed in background.

> I think c) executes program1 in background. When program1 finishes it
> executes program 2 in background. When program2 finishes it starts
> program3 in background.

> Correct ?

 
 
 

what is this doing ? (bakcground execution)

Post by Chri » Wed, 28 Jun 2006 18:28:44




>> What are differences on this sentences of Unix programas executuions ?

>> a) program1;program2;program3

> Runs the three consecutively.

So what is the difference than with

program1 && program2 && program3

Will program2 only start when program1 has finished?

Quote:>> b) program1;program2;program3 &

> Runs the three consecutively, but backgrounds the last.

>> c) (program1;program2;program3) &

> Runs the three consecutively from a subshell --
> same as the first with more busy work.

>> I think a) starts to execute command1. When command1 finishes, starts
>> programa2. When programa2 finishes, starts program3.

>> I think b) is same as a), except program 3 is executed in background.

>> I think c) executes program1 in background. When program1 finishes it
>> executes program 2 in background. When program2 finishes it starts
>> program3 in background.

>> Correct ?

 
 
 

what is this doing ? (bakcground execution)

Post by Herbert Popha » Wed, 28 Jun 2006 19:11:33





>>>What are differences on this sentences of Unix programas executuions ?

>>>a) program1;program2;program3

>>Runs the three consecutively.

no matter what their termination status is.

Quote:> So what is the difference than with

> program1 && program2 && program3

> Will program2 only start when program1 has finished?

Program2 is started when program1 has finished successfully, i.e. exit
code 0. Same applies to program3 with respect to program2.

Herbert

 
 
 

what is this doing ? (bakcground execution)

Post by Lew Pitche » Thu, 29 Jun 2006 02:09:50


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



> > What are differences on this sentences of Unix programas executuions ?

> > a) program1;program2;program3

> Runs the three consecutively.
[snip]
> > c) (program1;program2;program3) &

> Runs the three consecutively from a subshell --
> same as the first with more busy work.

Not quite.

Example c runs three programs consecutively, in a subshell /that has
been placed in the background/. Unlike example a, in which the shell
suspends tty input to the commandline (as opposed to the program) from
the start of program1 through to the end of program3, the shell in
example c will accept input immediately on start of execution of the
subshell, concurrent with the execution of program1, program2, and
program3.

- --
Lew Pitcher

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

iD8DBQFEoWZZagVFX4UWr64RAg7NAJ9MqgxDNU4esUBTTsDFLt7UhQSC0gCgv3CI
u5bph3KIKaW4TV2aEFDx40s=
=HeP4
-----END PGP SIGNATURE-----

 
 
 

1. exit code of the remote command execution (done via rsh)

Hello,

This question has been asked a few times, but I was wondering if there has
been any modification.

If you are doing
rsh hostname fooprog - How do you obtain the exit code of fooprog ?

- Has rsh been enhanced to do that ? or we just resort to doing
  rsh hostname fooprog; echo $?

thanks,
tarak

2. help!

3. Ordered execution Vs. Random execution

4. endwin() after using ncurses deletes screen

5. Dual Homed Linux - what am I doing wrong?

6. kernel 2.0.9 compile error ide.c

7. Am I doing something wrong?? - (SAMBA)

8. linux browsers and avi files

9. One more question - What am I doing wrong?

10. How do I get 'w' to say that i am doing something else

11. KNode (No Caching) - What am I doing no wrong

12. gethostbyname misbehavior - what am i doing wrong.

13. Shutdown problems...am I doing it right?