linux - $VARIABLE 和 ${VARIABLE} 有什么区别

标签 linux bash variables

任何人都可以向我解释为什么一些 Linux 专家建议我们在 Bash 脚本中使用 ${VARIABLE} 吗?似乎没有任何区别。

最佳答案

假设您要打印 $VARIABLE 紧跟 "string"

echo "$VARIABLEstring"    # tries to print the variable called VARIABLEstring
echo "${VARIABLE}string"  # prints $VARIABLE and then "string"

Bash 还支持 string manipulation使用此语法。

关于linux - $VARIABLE 和 ${VARIABLE} 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8254864/

相关文章:

linux - vmstat : What exactly does cpu wait mean?

java - 测试不工作

php - MySQL:错误#2002

linux - 用于在远程计算机上的日志文件中搜索字符串并复制匹配文本的脚本

linux - 如何根据给定的模式按顺序输出匹配的字符串

bash 脚本 : use command output to dynamically create menu and arrays?

python - 找不到 Bazel 构建包

bash - bash中双方括号的含义

php - 使用范围解析运算符(::) 分配变量与 $this->variable 相同吗?

javascript - 如何使用单个函数获取所有 javascript 变量?