Question
This is for shellscript using vi and putty I need to Create an executable BASH shell ( bash ) shell script that will: Require exactly
This is for shellscript using vi and putty
I need to Create an executable BASH shell (bash) shell script that will:
Require exactly 2 command line arguments and calls the error_function passing the error message as an argument to the function that says You must enter Exactly 2 command line arguments, please try again: The error function takes the argument passed to it, prints it and then exits with an exit code of 1.
Tell the user the values of the two command line arguments that they entered and ask for a Y or y or N or n to confirm that they do or do not want to continue. If they did do a typo, and the user enters an N or n meaning that they did make a mistake and wish to quit, then call the error function passing the ermessage to the function with a different message saying Program exiting because you said you had a typo, please try again:. If the user enters something other than a yYNn then call the error function passing the message "You did not enter a Y or an N please try again"
Tell the user if the command line arguments they entered were indeed files in the directory that the user specified. If one or both files did not exist, call the error function and give the message: Sorry, one or both files not located, please try again: .
Then test to see if each file that exists is a regular type of file or if one or the other is a directory type of file. If one of the files is a directory type of file, call the error function and display this message: Sorry, one or both of the files that you entered was a directory, please try again:
In all cases an argument is passed to the same error function that prints the text that is outlined in bold on this page.
Tell the user if they own or do not own each of the files that they entered. (Hint: run man test to figure out how to test for these things.)
Tell the user which file is newer of the 2 file names they entered.
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