Sponsored Content
Top Forums Shell Programming and Scripting Help with make sure shell script execute instruction in flow Post 302507159 by fpmurphy on Wednesday 23rd of March 2011 12:01:12 AM
Old 03-23-2011
You have not said what shell you are using but all modern shells have a wait builtin which will do what you want.

Here is the relevant section from the bash manpage.
Quote:
wait [n]
Wait for the specified process and return its ter-
mination status. n may be a process ID or a job
specification; if a job spec is given, all pro-
cesses in that job's pipeline are waited for. If n
is not given, all currently active child processes
are waited for, and the return status is zero. If
n specifies a non-existent process or job, the
return status is 127. Otherwise, the return status
is the exit status of the last process or job
waited for.
This User Gave Thanks to fpmurphy For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help need to make a shell script run for ffmpeg vhook watermaking in shell

i have a small problem getting a batxh shell script to run in shell this is the code the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies

2. Shell Programming and Scripting

Is there a way to make bash [or another shell] use all CPU cores to execute a single script?

I wrote a very simple script that matches combinations of alphabetic characters (1-5). I want to use it to test CPU speeds of different hardware/platforms. The problem is that on multi-core/processor systems, only one CPU is being utilized to execute the script. Is there a way to change that?... (16 Replies)
Discussion started by: ph0enix
16 Replies

3. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

4. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

5. UNIX for Dummies Questions & Answers

can't execute a shell script

Hi all, As i want to know how the shell command "nohup" worked.I logged in as the user named vincent through Gnome.Then i press ctrl+atl+F1 changed into a console and logged in as another user named kinsley.The user "kinsley" is added by me with "useradd",and now there's no HOME directory for... (6 Replies)
Discussion started by: homeboy
6 Replies

6. Shell Programming and Scripting

Continue an instruction on more than one line in a script shell ?

Hello, I have a very long instruction to write, but, for lisibility reasons, I would like to cut it on more than one line and comment each lines. is it possible ? thanks :b: (1 Reply)
Discussion started by: shadok
1 Replies

7. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

8. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

9. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (1 Reply)
Discussion started by: radha254
1 Replies

10. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (5 Replies)
Discussion started by: radha254
5 Replies
wait3(2)							System Calls Manual							  wait3(2)

NAME
wait3(), wait4() - wait for child process to change state SYNOPSIS
DESCRIPTION
The and functions allow the calling process to obtain various status information for a caller's child process based on the options speci- fied. If status information is available for two or more child processes, the order of which process to report status on is not defined. The function is similar to except that waits for a specific child as indicated by the pid parameter. Note that the following call is equivalent to the call: Note that the following call is equivalent to the call: In both of the previous prototypes, on successful completion, if the resource_usage argument to or is not a null pointer, the structure that the resource_usage argument points to is filled in for the child process identified by the return value. The pid argument specifies a child process for which status is requested. The following rules define which status information is returned: o If pid is equal to (pid_t) -1, status is requested for any child process. o If pid is greater than 0, it specifies the process ID of a single child process for which status is requested. o If pid is 0, status is requested for any child process whose process group ID is equal to that of the calling process. o If pid is less than (pid_t) -1, status is requested for any child process whose process group ID is equal to the absolute value of pid. The stat_loc argument is the address where status about the specified child process is placed. The options argument is constructed from the bitwise-inclusive OR of zero or more of the following flags defined in the header file: The status of any continued child process specified by pid that has not been reported since it continued is reported to the requesting process. The and functions will not suspend execution of the calling process if status is not immediately available for one of the child processes specified by pid. This causes the wait not to be registered. This means that the registered process that is being waited on, can be waited on again with identical results, provided that the status of the child does not change in the meantime. The status of any child processes specified by pid that are stopped and whose status has not yet been reported since they stopped, will also be reported to the requesting process. The resource_usage argument points to the resource utilization structure. APPLICATION USAGE
Threads Considerations In a multi-threaded application, only the calling thread is suspended by and The and functions will not return until all threads in the process have reached the desired state. For example, and will not return until all threads have terminated. If the or options are specified, and will not return until all threads have stopped or continued respec- tively. RETURN VALUE
If or returns because the status of a child process is available, the return value is the process ID of that child process. If or returns due to the receipt of a signal, the return value receives a and is set to If or was called with the options argument where status is not available for any process specified by the pid argument, will be returned. Otherwise, (pid_t) will be returned and will be set to indicate the error. ERRORS
If or fails, is set to one of the following values: The calling process has no existing unwaited-for child processes; or the states specified by the options argument are invalid for the set of processes specified by the pid argument. Problems were encountered in the retrieval of status information for the specified child process. The or function has been interrupted by a signal. The value in the location pointed to by the stat_loc argument is unde- fined. The options argument to or is invalid. WARNINGS
The behavior of and is affected if the signal is set to See the WARNINGS section of signal(5). Signal handlers that cause system calls to be restarted can affect the condition described above (see bsdproc(3C) and sigaction(2)). AUTHOR
The and functions were developed by HP, AT&T, and the University of California, Berkeley. SEE ALSO
exec(2), exit(2), fork(2), pause(2), wait(2), waitpid(2). wait3(2)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy