1: #!/bin/sh
2:
3: background()
4: {
5: sleep 10
6: echo "Background"
7: sleep 10
8: # Function will return here - if backgrounded, the subprocess will exit.
9: }
10:
11: echo "ps before background function"
12: ps
13: background &
14: echo "My PID=$$"
15: echo "Background function PID=$!"
16: echo "ps after background function"
17: ps
18: exit 0
| last modified 22/03/2012 | Introduction | Table of Contents (frame/no frame) |
Printable (single file) |
© Dartmouth College |