Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with this in Bash script Create a bash script that accomplish the following three items: 1) Print a welcome message with your information

need help with this in Bash script

image text in transcribed

Create a bash script that accomplish the following three items: 1) Print a welcome message with your information and the machine name ($HOSTNAME) 2) Display a user menu to choose from one of the following three options. a. Verify who the user is, test to see if the user is root and display a message acknowledging him or her i. i. Most Linux servers have an environment variable called $UID. If the numerical value of $UID is 0, then the user is root. ii. Use a CASE statement to accomplish this step. b. Check if the script is running on a Linux OS, for example, bash could be running through Cygwin, which isn't Linux. i. To obtain the operating system, run the uname -s command. Capture the output of this system call in a variable. ii. Use an IF statement to accomplish this step c. Check if the -w argument was given as the first argument. i. If this is the case, check if a second parameter is defined ii. If you have a second parameter, print out that second argument three times. (For example, if you run your script with "$ task1.sh -w mytest", and you select the third option, it should print "mytest mytest mytest" iii. If there is NOT a second argument, display a message to the user 3) Finally, your script should provide a -help option. This should be passed to the script as your first parameter. Provide a help message describing your script through a function

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

Explain the importance of nonverbal messages.

Answered: 1 week ago

Question

Describe the advantages of effective listening.

Answered: 1 week ago

Question

Prepare an employment application.

Answered: 1 week ago