Questions
- Which of the following statements is true?
- You should always use
getopt
, because it’s easier to use thangetopts
. getopt
can handle arguments that contain blank spaces, butgetopts
can’t.getopt
requires you to use one or more shift commands with every option, butgetopts
doesn’t.getopts
can handle long options, butgetopt
can’t.
- You should always use
- In this
while getopts :a:b:c options; do
line, what does the first colon do?- It suppresses error messages from the shell.
- It causes the
-a
option 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...
-