Question: Write a bash script that will determine if there are processes running for a given userid. Requirements for your script: Name your script Q1.sh Your
Write a bash script that will determine if there are processes running for a given userid. Requirements for your script: Name your script Q1.sh Your script should use one parameter, $1, which will be a userid that will be used in the command line-list All commands should be on one line, i.e. use a command-line list Use the && notation in your command-line list Functionality: Retrieve only the userids for all running processes The command for this is: ps -a -o user Try running that command before you write your script, just so you can see its ouput Pipe the output from the ps command to grep, using grep to see if the userid is in that list If the userid has a process running, echo a message to the screen If the userid does not have a process running, do nothing Be sure to make your script executable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
