Question: 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

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

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

1 Expert Approved Answer
Step: 1 Unlock

To create the script Q5sh and meet the specified requirements follow these steps Step 1 Create the D... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!