Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试让参数替换在我的 bash 脚本中工作……我知道我搞错了……我正在尝试创建一个脚本来重命名文件的一部分。
#!/bin/bash for i in *.hpp; do mv -v "$3 ${$3/$1/$2}" ; done
我得到的错误是:
line 2: $3 ${$3/$1/$2}: bad substitution
${$3}将尝试插入${"CONTENTS OF $3"}变量。更有可能是您想要${3}的。更有可能是您想要${i}的。
${$3}
${"CONTENTS OF $3"}
${3}
${i}