Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Use vi to create the following script. Call the file script. When completed, change the permissions to 745. Run the script by typing /scriptl

image text in transcribed
1. Use vi to create the following script. Call the file script. When completed, change the permissions to 745. Run the script by typing /scriptl #1 /bin/bash echo You are USER echo Your home directory is $HOME echo Your home directory consists of du-sH Alter your script so the output of each echo statement is redirected to the file info.txt. How did you do this? 2. Use vi to create the following script, calng it script2. When completed, change the permissions and run it #1 /bin/bash echo What is your name? read NAME echo What is your username? read USERNAME echo Hello NAME, your home directory contents and size: Complete this script by adding instructions to output this user's home directory contents assuming that the user's home directory will be /home/SUSERNAME as well as using the du statement from scriptl to output the disk usage of the user's home directory 3. Rewrite the script from #2 so that the NAME and USERNAME are supplied to the script by parameters and remove the first four instructions (the first two echo and the two read statements). Save and test your script. 4. Write the following script, calling the file script4. Change its permissions appropriately #1 /bin/bash if [ $# -ne 2 ]; then echo Illegal input elif $1 -gt $2 1 then echo $1 is greater else echo $2 is greater fi Save and run the script providing it no parameters, two parameters of 5 and 10, two parameters of 10 and 5, and two parameters of 5 and 5' What does [ $#-ne 2] mean? Do we need this in the script? Show how you would alter the script so that it can also output if the two parameters are the same

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

9. Mohawk Industries Inc.

Answered: 1 week ago