使用getopts(带有“s”).
根据Bash FAQ 35:
Unless it’s the version from util-linux,and you use its advanced mode,never use getopt(1). getopt cannot handle empty arguments strings,or arguments with embedded whitespace. Please forget that it ever existed.
The POSIX shell (and others) offer getopts which is safe to use instead.