Question: 2 . ( 1 0 points ) Write a BASH shell script that finds a given command on the search path. If the number of
points Write a BASH shell script that finds a given command on the search path. If the number of command line arguments is incorrect, then print a usage message and exit with exit code If found, then display the pathname and exit with exit code If not found, then display an error message and exit with exit code You may not use the which, find, locate or any similar Linux command. You must use conditional tests. You must use the $PATH environment variable. Hint: use the tr command.
Filename: cmdsearch.sh
Usage: cmdsearch.sh cmd
points Using your solution in Question as an example, write a BASH shell script that takes a regular expression pattern argument and finds all commands on $PATH that match the given pattern. If the number of command line arguments is incorrect, then print a usage message and exit with exit code If found, then display the pathname and exit with exit code If not found, then display an error message and exit with exit code You may not use the which, find, locate or any similar Linux command. You must use conditional tests. You must use the $PATH environment variable. Hint: use sim
Filename: cmdfind.sh
Usage: cmdfind.sh pattern
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
