Question
Q: Write a short bash script findlocation that takes a 6-digit prefix in the argument and displays the corresponding location. If the script receives no
Q: Write a short bash script findlocation that takes a 6-digit prefix in the argument and displays the corresponding location. If the script receives no argument or the argument is not a 6-digit prefix made only out of the digits 0 thru 9, the script must return an exit condition code signaling failure (e.g. by executing exit 1). If the script receives a correctly formatted argument but the prefix is not found in the nanpa file, the script must return an exit condition code signaling failure. Otherwise, the script must display the appropriate location (on stdout). The location must not be prefixed by the prefix nor followed by superfluous spaces. This means you have to format the line found the nanpa file before displaying it. You may use grep and sed for this script.
- XStep 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