Questions
- Which of the following statements is true?
- You should always use
getopt, because it’s easier to use thangetopts. getoptcan handle arguments that contain blank spaces, butgetoptscan’t.getoptrequires you to use one or more shift commands with every option, butgetoptsdoesn’t.getoptscan handle long options, butgetoptcan’t.
- You should always use
- In this
while getopts :a:b:c options; doline, what does the first colon do?- It suppresses error messages from the shell.
- It causes the
-aoption to require an argument. - It doesn’t do anything.
- The colons cause the options to be separated from each other.
- You need to create a script that accepts options, options with arguments, and non-option arguments. Which of the following commands must you insert into the script to make non-option arguments work?
-
shift $(($OPTARG -1...
-