In: Computer Science
As you complete each of the following steps, keep track of what occurs at each point; including what you type, the output given, and any errors experienced. Submit this information in a log to your instructor for this week’s assignment. Your log can use the sample format provided, or you can create your own.
1. Run the following script:
a. #!/bin/bash
b. count=1
c. echo "start of the program"
d. while [ $count -le 10 ]
e. do
1) echo "Loop #$count"
2) sleep 10
3) count=$[ count + 1 ]
f. done
g. echo "end of the program
2. Modify the program to add a trap for SIGINT and SIGTERM.
3. Save the script and then run the script in the background.
4. Use the jobs command to display a list of the jobs currently running.
5. Find the process id of the script and kill the job.
6. Check to see if you get the trap message.
7. Run the script again using the at command to schedule the job in the future. Wait for the job to run to make sure it executes.
PLEASE POST SCREENSHOTS.
#!/bin/bash
warning(){
echo -e "\n*** CTRL+C and CTRL+Z keys are disabled. Please enter
number only. Hit [Enter] key to continue..."
}
trap warning SIGINT SIGTERM
count=1
echo "start of the program"
while [ $count -le 10 ]
do
echo "Loop #$count"
sleep 10
count=$[ count + 1 ]
done
echo "end of the program"
warning
if you have any doubt then please ask me without any hesitation in the comment section below, if you like my answer then please thumbs up for the answer, before giving thumbs down please discuss the question it may possible that we may understand the question in a different way and I can edit and change the answers if you argue, thanks :)