Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a C - Shell script program that will read environment variable from a environment . cfg which contains the values of three environment variables

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:
enVar1Create 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.
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.

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_2

Step: 3

blur-text-image_3

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions