Files
linux.softwareshinobi.com/landing/docs/.recycle/.recycle2/121-the-wait-command.md
Software Shinobi 7d9171c854
All checks were successful
learn org at code.softwareshinobi.com/linux.softwareshinobi.com/pipeline/head This commit looks good
reworking content
2025-06-19 10:03:08 -04:00

528 B

The Wait commands

It is a command that waits for completing any running process of given id. if the process id is not given then it waits for all current child processes to complete.

Example

This example shows how the wait command works :

Step-1:

Create a file named "wait_example.sh" and add the following script to it.

#!/bin/bash
echo "Wait command" &
process_id=$!
wait $process_id
echo "Exited with status $?"

Step-2:

Run the file with bash command.

$ bash wait_example.sh