opts4

来自「Advanced Bash&#8722 Scripting Guide An 」· 代码 · 共 19 行

TXT
19
字号
#!/bin/sh# Program opts4# Using getopts -- Fourth try --while getopts xyz: arguments 2>/dev/nulldo    case $arguments  in	x) echo "you entered -x as an option .";;	y) echo "you entered -y as an option." ;;	z) echo "you entered -z as an option."	echo "\$OPTARG is $OPTARG.";;	\?) echo "Usage opts4 [-xy] [-z  argument]"	exit 1;;    esacdoneecho "The initial value of \$OPTIND is 1.The final value of \$OPTIND is $OPTIND.Since this reflects the number of the next command line argument,the number of arguments passed was `expr $OPTIND - 1`. "

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?