shell脚本参数$ {1 ,,} _ name

时间:2016-03-23 07:27:16

标签: shell scripting

我遇到过已经存在的shell脚本。想要了解$ {1 ,,}在这里的含义:

if [[ ${2} -eq 0 ]]; then
delNam${1,,}_delete_$date 

shell脚本新手。

2 个答案:

答案 0 :(得分:1)

${1,,}convert第一个positional parameter改为小写。换句话说,如果脚本像./script.sh FooBar 0一样运行而$date2016,则第二行将扩展为delNamfoobar_delete_2016,然后将作为命令运行。< / p>

答案 1 :(得分:0)

$ {2}用于输入第二个参数&amp; delNam $ {1 ,,} 删除 $ date,用于输入当前日期的第一个参数。