code for the script home / study / engineering / computer science / questions an
ID: 3812045 • Letter: C
Question
code for the script
home / study / engineering / computer science / questions and answers / code for te script #!/bin/bash x=10 sleep 10m while ...
Your question has been answered
Let us know if you got a helpful answer. Rate this answer
Question: Code for te script #!/bin/bash x=10 sleep 10m whil...
Bookmark
code for te script
#!/bin/bash
x=10
sleep 10m
while [ $x -gt 0 ]
do
clear
echo "$x seconds until blast off"
x=$(( $x - 1 ))
done
Explanation / Answer
I have run your generator script and triggered four processes by using the following command. I have named generator script as "fourprocess.sh". I have executed it four times as a background process.
$ ./fourprocess.sh &
[5] 6378
[4] Exit 126 ./ fourprocess.sh
l$ ./fourprocess.sh &
[6] 6380
$ ./fourprocess.sh &
[7] 6382
l$ ./fourprocess.sh &
[8] 6384
Now if you see, the running process,
$ ps -eaf|grep fourprocess
naresh 6378 6223 0 09:43 pts/5 00:00:00 /bin/bash ./fourprocess.sh
naresh 6380 6223 0 09:43 pts/5 00:00:00 /bin/bash ./fourprocess.sh
naresh 6382 6223 0 09:43 pts/5 00:00:00 /bin/bash ./fourprocess.sh
naresh 6384 6223 0 09:43 pts/5 00:00:00 /bin/bash ./fourprocess.sh
You can see the four processes are running in the background. Now kill the four process using kill command.
$ kill -9 6378
$ kill -9 6380
$ kill -9 6382
$ kill -9 6384
$fg
bash: fg: job has terminated
[5] Killed ./fourprocess.sh
[6] Killed ./fourprocess.sh
[7]- Killed ./fourprocess.sh
[8]+ Killed ./fourprocess.sh
To find history, just run the command "history" on your terminal. You will get the output.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.