Question
1) Exit from script, if is currently enabled; if it is not enabled, skip this item (1) 2) Using the vi editor, create a shell
1) Exit from script, if is currently enabled; if it is not enabled, skip this item (1)
2) Using the vi editor, create a shell script file to do the following:
a) Issue “ sleep 1500 &” command to run it as a background process.
b) The two-character shell variable $! Contains the process ID (pid) of the above sleep process running in the background. Display the content of the variable $!.
c) Issue ps command to see that the sleep process is running.
d) Store the sleep process ID (pid) in a user defined (your own) shell variable
e) Issue cat command with a filename that does not exist
f) The two character shell variable, $? Contains the completion status of the previous cat command. Using an if statement, check the completion status of the above cat command by checking the value of $?. If cat command is successful, then echo cat command completed successfully else echo cat command failed .
g) Kill the background process with pid stored in your shell variable above as the argument to kill command
h) Issue ps command to see that the background process is terminated.
i) Echo, the script is done using echo command
3) Issue script command to capture the output of the items below
4) Add execute permission to the file
5) Display the attributes of the script file
6) Display the content of the script file
7) Run the script file by typing the name of the script file.
Step by Step Solution
3.36 Rating (159 Votes )
There are 3 Steps involved in it
Step: 1
sleep 1500 sleep 1500 store sleep process in sleepid sleeppid print sleep process echo sleeppid get ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
609427c3dd420_24543.pdf
180 KBs PDF File
609427c3dd420_24543.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started