Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

Why do opaque materials become warmer when light shines on them?

Answered: 1 week ago