Question: Consider the following script and answer the questions: 1 2 8 10 11 12 9012 13 14 15 while getopts t: opt; do case
Consider the following script and answer the questions: 1 2 8 10 11 12 9012 13 14 15 while getopts "t:" opt; do case ${opt} in t ) target=$OPTARG echo FOO ;; \? ) echo "Invalid option: $OPTARG" 1>&2 ;; : ) esac done echo "Invalid option: $OPTARG requires an argument" 1>&2 ;; shift $((OPTIND -1)) 1) Assume that the scriptname is "myscript". How do you call/run this script in order to display "FOO". 2) Explain how the script works. (explain each line) 3) What is the role of the last command in this script?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
