getopts prints out error message for invalid option name, but script
isn't halted.
invalid arguments, such as out of valid range, could be discarded
silently or replaced with a reasonably valid argument, also silently.
This commit forces to exit with status 1 at the point where the invalid
option name or argument is detected, with an error message from getopts
or the script.
Prior to this commit:
getopts
prints out error message for invalid option name, but script isn't halted.invalid arguments, such as out of valid range, could be discarded silently or replaced with a reasonably valid argument, also silently.
This commit forces to exit with status 1 at the point where the invalid option name or argument is detected, with an error message from
getopts
or the script.