使用getopts(带有“s”).
原文链接:https://www.f2er.com/bash/383681.html根据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.