Question
In this IP, you will use the Cygwin64 Terminal to run the vi text editor, create three small Linux scripts, and then execute them. Please
In this IP, you will use the Cygwin64 Terminal to run the vi text editor, create three small Linux scripts, and then execute them. Please submit your work as a Microsoft Word document labeled "CS227_U5_IP_YourName". In your Word document, you need to include each of your three scripts, and the corresponding screenshots of the outcome of execution of the scripts. Last but not the least, you should also write a short paragraph which provides your takeaways for this IP (e.g., you may summarize what you have learned from coding each of three scripts in one sentence, so that three summation sentences together will become the short paragraph required). If everything works as planned, the total number of pages of CS227_U5_IP_YourName file should be not over 3 pages (including two pages of scripts plus short summation paragraph, and one page of screenshots). After you have created each of script file, please use Linux command chmod +x to that file first so that it becomes executable. Then you can use another Linux command sh to run that script. For example, assume that the name of your first script file is my_first_script.sh, you will do the following two steps: Step1: chmod +x my_first_script.sh Step2: sh my_first_script.sh. Below are the specifications of the three Linux scripts. Script 1: Environment Configuration plus File Management Create a C-Shell script program that will read environment variable from a environment.cfg which contains the values of three environment variables as shown below: enVar1 enVar2 enVar3 In your script program, please do the following: Put #! /bin/csh in the first line (interpreter line) of the program. Check to see if the environment.cfg file exists if it does not display an error to the user, and exit the program. Create a loop to read from the environment.cfg, and place each of the lines read into an array element. Create a switch statement within the loop where each case will check what was read from the array in the respective iteration. Within each case, set the environment variable based on the value in the array element that was read from the configuration file. Once the loop has completed, create another loop to echo only the environment variable name, and display to the screen as well as displaying to an output file named outputFile.txt. After the final loop has completed, exit the script. Script 2: Creating Functions Create a BASH script program that will demonstrate creating functions in Linux programming. In your script program, please do the following: Put #!/bin/bash in the first line (interpreter line) of the program. Define three integer variables named as FirstSum, SecondSum, and Product. Create the first function named Sum which will read in two arguments, add the values of two arguments, and then return the sum of these two arguments. Create the second function named Multiplication which will read in two arguments, then multiply the values of two arguments, and then return the product of these two arguments. Call function Sum with two arguments as 100 and 200, and assign the result to a variable named FirstSum. Call function Sum with two arguments as 300 and 400, and assign the result to a variable named SecondSum. Call function Multiplication with the values of First Sum and SecondSum. Exit.the script. Script 3: Application Process Control Create a C-Shell script program that will demonstrate the use of using sequential, conditional, and iteration to control the application process control. In your script program, please do the following: Put #! /bin/csh in the first line (interpreter line) of the program Declare an integer variable to hold user input. To begin sequentially, output to the screen prompting the user to enter a number. Accept the user input, and assign it to the integer variable that you declared. Create an if condition statement checking the number that was input to see if it is less than 100. If the number is less than 100, output to the screen that the number is less than 100. If the number is equal to 100, output to the screen that the number is equal to 100. If the number is greater than 100, output to the screen that the number is greater than 100. Create a while loop to reduce the variable value that the user input to 0, and in each iteration output to the screen the value of the variable. Be creative and output anything else that you would like here. Once the while loop is complete and prior to the end of your program, output to the screen that the script has ended and goodbye. Exit the script.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started