how to write script that know when a program had ended
Hi need to find out how to write script that will know when a command had ended its execution. e.g
for ( A = 1; A < 10 ) execute test; end of test then increment value of A; end for thanks |
Assuming you want to write a bash script, you can find the syntax of the for look in the bash manual page:
Quote:
|
one way to test if program has ended is to look, if the process is still running. You could grep the process list or look for /proc/pid.
Code:
i=0 |
The right way to do this in bash depends on whether your chosent test forks to the background or locks stdin.
Most programs will not return the control to the shell until they have finished, unless you explicitly fork them to the background by using the ampersand operator, like in: Code:
$ startx& Code:
for <whatever> Code:
for <whatever> |
All times are GMT -5. The time now is 01:18 PM. |