You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
732 B
21 lines
732 B
#!/bin/sh |
|
# This script is a spell that will teach you about the bg and fg commands in POSIX-compliant Bash |
|
# To study the code of the examples, please use the command: cat 12_bg.sh |
|
|
|
echo "This spell will teach you about the bg and fg commands in POSIX-compliant Bash" |
|
echo "To study the code of the examples, please use the command: cat 12_bg.sh" |
|
|
|
# Running a command in the background |
|
sleep 5 & |
|
echo "Background task started. You can continue with other spells while waiting for it to finish." |
|
|
|
# Listing background tasks |
|
jobs |
|
|
|
# Moving a background task to the foreground |
|
fg %1 |
|
echo "Background task is now in the foreground." |
|
|
|
# Sending a background task to the background |
|
bg %1 |
|
echo "Foreground task is now in the background."
|
|
|