更新 README.md

This commit is contained in:
2024-07-26 14:19:24 +08:00
parent a738442fb0
commit a8c42ff943

View File

@@ -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