Questions tagged «getopt»

30
使用getopts处理长和短命令行选项
我希望使用我的shell脚本来调用命令行选项的长短形式。 我知道getopts可以使用,但是像在Perl中一样,我无法对shell进行同样的操作。 关于如何完成此操作的任何想法,这样我就可以使用以下选项: ./shell.sh --copyfile abc.pl /tmp/ ./shell.sh -c abc.pl /tmp/ 在上面,这两个命令对我的shell来说意义相同,但是使用 getopts,我无法实现这些功能吗?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.