Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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

M All Mail- x D submit x D computer x MAll Mail- x A ALEKS: Ric x Graphing x M Mathway xe c Must Bet x M Unix Lab. x L unix Lab. x y E Assign x C Secure https google.com/document/d/1T2wng95clFMKruxuthoxsokliwLIIEocmzGq6EZbww//edit Assignment #5 File Fd View Tools, Alp 100s O View only CS 211 Unix Laboratory Assignment #5 Process ID Management 1. Run HW 5 Process Generator Script launches 4 processes) 2. Run command to determi e launched process ID's 3, Kill 4 processes newly generated 4. Submi a. Output showing new processes were created b, Command history showing commands used to kill newly created processes 5. Submit to shurn@ howard edu scs subject Assignment #5 a Ask me any 34 PM 4/5/2017

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.