Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a bash script that will accept a parameter, the name of a color, and then output the parameter in a matching font color. Requirements

image text in transcribed
image text in transcribed
Write a bash script that will accept a parameter, the name of a color, and then output the parameter in a matching font color. Requirements for your script: Name your script Q5.sh Your script should source a code snippet . Under the Assignment directory, create a directory named snippets In that directory, create a file named 5 colors Put these commands in 5 colors RED="033[31m" GREEN="\033[32m" BROWN="\033[33" BLUE="1033[34m" MAGENTA="\033[35m" RESET="\033[Om" Source the Q5 colors file in your script Your script should also use one parameter, $1, which will be the name of a color. You should then set a variable named color to the value of the parameter If the parameter wasn't entered, prompt the user to enter the name of the color and store the value in a variable named color You should then convert the variable color to uppercase. The command to do that is: colors (echoScolor tr [a -2] [A-Z]) Your script then use a case statement to determine the value of the variable color. You should check for value of the five colors in the 5 colors file, and, if there is a match, output Your script should also use one parameter, $1, which will be the name of a color. You should then set a variable named color to the value of the parameter If the parameter wasn't entered, prompt the user to enter the name of the color and store the value in a variable named color You should then convert the variable color to uppercase. The command to do that is: color=$(echo Scolor | tr [a-z] [A-Z]) Your script then use a case statement to determine the value of the variable color. You should check for value of the five colors in the Q5colors file, and, if there is a match, output the color with a matching font color The font color should be change back to default after each word is output If there is no match to the five colors, output a message in the default color that states "Some other color

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

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions