更新 README.md
This commit is contained in:
12
README.md
12
README.md
@@ -1469,7 +1469,10 @@ test.sh: option requires an argument -- a
|
||||
Invalid option: -
|
||||
[hello@Git shell]$ more test.sh
|
||||
#!/bin/bash
|
||||
while getopts "a:" opt; do
|
||||
|
||||
OPTIND=1 # 重置 OPTIND 以确保从第一个参数开始解析
|
||||
while getopts "a:" opt;
|
||||
do
|
||||
case $opt in
|
||||
a)
|
||||
echo "this is -a the arg is ! $OPTARG"
|
||||
@@ -1489,7 +1492,10 @@ this is -a the arg is ! hello
|
||||
[hello@Git shell]$ bash test.sh -a
|
||||
[hello@Git shell]$ more test.sh
|
||||
#!/bin/bash
|
||||
while getopts ":a:" opt; do
|
||||
|
||||
OPTIND=1 # 重置 OPTIND 以确保从第一个参数开始解析
|
||||
while getopts ":a:" opt;
|
||||
do
|
||||
case $opt in
|
||||
a)
|
||||
echo "this is -a the arg is ! $OPTARG"
|
||||
@@ -1541,6 +1547,8 @@ ROOTFS_PKG=rootfs
|
||||
USRFS_PKG=userfs
|
||||
ABOOT_PKG=bootloader
|
||||
SOPEN_PKG=sopen
|
||||
|
||||
OPTIND=1 # 重置 OPTIND 以确保从第一个参数开始解析
|
||||
while getopts "krubsh" opt;
|
||||
do
|
||||
case $opt in
|
||||
|
||||
Reference in New Issue
Block a user