gpt4 book ai didi

linux - 带有参数的 shell 脚本

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:01:17 24 4
gpt4 key购买 nike

#!/bin/bash
#if present -a flag then print this echo
#echo "A";
#if -b is present then print b
#echo "B"

#and if -c 10 present how can I read this value '10' ?

上面是我想看我的脚本的样子

我希望能够像这样开始

myscript.sh -a -b -c 10

myscript.sh

myscript.sh -a -c 10

myscript.sh -c 10

等等

最佳答案

在您的 shell 中键入“man getopt”,然后按照说明进行操作。

关于linux - 带有参数的 shell 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8895658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com