Question
Bash, unix command line Write a Bourne again shell script that keeps on prompting the user for a utility name and tries to find the
Bash, unix command line
Write a Bourne again shell script that keeps on prompting the user for a utility name and tries to find the full path. Assume that the user always responds a prompt by entering a name, denoted as name. The user enters QUIT to indicate end. Script stops after reading quit. Otherwise, script checks if name represents an existing file or directory in the current directory. If it exists, it outputs "name is a regular file in current directory", and continues prompting. If it is an existing directory, it outputs "name is a directory in current directory".
If name is no file or directory, script executes which to search for the path of the name. If found, "name is found", otherwise "name is not found".
Format
echo -n "enter name:"
While Do
If
Then
Examples output
Ls Classlist dir1 dir2 script.Sh
Enter name: classlist Classlist is a regular file.
Enter name :dir1 Dir1 is a directory in current directory.
Enter name : mkdir
Mkdir is found
Enter name : QUIT $
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