Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me use the appropriate linux commands to execute the following tasks Question 1. Create a shell script file called q1.sh Write a script

Please help me use the appropriate linux commands to execute the following tasks

Question 1.

Create a shell script file called q1.sh

Write a script that would accept the two strings from the console and would display a message stating whether the accepted strings are equal to each other.

1.Execute the script q1.sh

2.Enter "hello" for the first string input

3.Enter "hello" for the second string input

4.Show the output

5.Execute the script q1.sh again

6.Enter "hello" for the first string input

7.Enter "hi" for the second string input

8.Show the output

Question 2.

Create a shell script file called q2.sh

Write a bash script that takes a list of files in the current directory and copies them as into a sub-directory named mycopies.

1.Open q2.sh file and show your code.

2.Close the file. Now, show the list of files in the current directory.

3.If mycopies directory exists, open it and show the contents.

4.Execute the script q2.sh

5.Open mycopies directory and show that the files in your current directory have now been copied into the mycopies directory.

Question 3.

Create a shell script file called q3.sh

Write a Bash script that takes the side of a cube as a command line argument and displays the volume of the cube.

1.Open q3.sh file and show your code.

2.execute q3.sh with the side of cube (any integer) as a command line argument.

Question 4.

Create a shell script file called q4.sh

Write a Bash script that prompts you for a user name and displays the corresponding users id number (UID), group id number (GID), and his/her home directory. Note: this information can be found in the /etc/passwd file.

1.Open q4.sh file and show your code.

2.execute q4.sh.

3.Enter your username as input

4.Show the output

Question 5.

Create a shell script file called q5.sh

Write a bash script that will edit the PATH environment variable to include the sourcefiles directory in your home directory and make the new variable global.

1.Open q5.sh file and show your code.

2.Show the content of your PATH variable

3.execute q5.sh.

4.Show the content of your PATH variable again

5.Show the content of your .bashrc file to show that the new PATH has been added to the .bashrc file from your 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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago