1 Star 0 Fork 0

牧之/Generate_Kernel_Uboot_Project_forIDE

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
getopttest.sh 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
# ?a? and ?arga? have optional arguments with default values.
# ?b? and ?argb? have no arguments, acting as sort of a flag.
# ?c? and ?argc? have required arguments.
# set an initial value for the flag
ARG_B=0
# read the options
TEMP=`getopt -o a::t:i::o:: --long action::,type:,source-dir::,input:: -- "$@"`
eval set -- "$TEMP"
# extract options and their arguments into variables.
while true ; do
case "$1" in
-a|--action)
case "$2" in
"") action='genproj' ; shift 2 ;;
*) action=$2 ; shift 2 ;;
esac ;;
-t|--type)
case "$2" in
"") prjtype='genproj' ; shift 2 ;;
*) prjtype=$2 ; shift 2 ;;
esac ;;
-i|--input)
case "$2" in
"") shift 2 ; shift 2 ;;
*) input=$2 ; shift 2 ;;
esac ;;
-o|--output)
case "$2" in
"") shift 2 ; shift 2 ;;
*) output=$2 ; shift 2 ;;
esac ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
# do something with the variables -- in this case the lamest possible one :-)
echo "ARG_A = $action"
echo "ARG_B = $input"
echo "ARG_C = $output"
echo "ARG_C = $prjtype"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/uart_115200_8n1/Generate_Kernel_Uboot_Project_forIDE.git
git@gitee.com:uart_115200_8n1/Generate_Kernel_Uboot_Project_forIDE.git
uart_115200_8n1
Generate_Kernel_Uboot_Project_forIDE
Generate_Kernel_Uboot_Project_forIDE
master

搜索帮助