gpt4 book ai didi

linux - 这些参数扩展意味着什么?

转载 作者:太空宇宙 更新时间:2023-11-04 03:36:59 25 4
gpt4 key购买 nike

请解释一下linux命令:

find . -type f -iname '*.sh'"${1:-}"'*' -exec ${2:-file} {} \; ;

具体来说,我想了解以下部分:

  • ${1:-}
  • ${2:-文件}

它们实际上是什么意思/做什么?是否有任何 Linux 引用资料可供我阅读以了解有关这些类型语法的更多信息?

最佳答案

这些是 bash 变量替换:

http://www.tldp.org/LDP/abs/html/parameter-substitution.html

如果“:-”之前的变量尚未定义,则它们会替换“:-”后面的值。 $1 和 $2 变量指的是传递给脚本或函数的第一个和第二个参数。

关于linux - 这些参数扩展意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31250423/

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