<分区>
在 Pycharm 中,当我们使用变量时,例如$privateKey
,我们收到警告 Simple variable usage 如下图,建议我们转向语法 ${privateKey}
我的问题是为什么我们会收到这样的警告?使用这样的简单变量有什么风险?
点击more
时
<分区>
在 Pycharm 中,当我们使用变量时,例如$privateKey
,我们收到警告 Simple variable usage 如下图,建议我们转向语法 ${privateKey}
我的问题是为什么我们会收到这样的警告?使用这样的简单变量有什么风险?
点击more
时
最佳答案
感谢@Whymarrh。一answer如下所示。
since "$foobar" would instead expand foobar
我的答案是在字符串 "$myVarnotInVar"
中分隔/区分 $myVar
和 notInVar
换句话说
myVar=122
echo "$myVarnotInVar" # will print empty string "" since undefined variable $myVarnotInVar
echo "${myVar}notInVar" # will print 122notInVar
关于bash - 为什么 Pycharm 在 .sh bash 脚本中对 "simple variable usage"发出警告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40581956/
相关文章:
unit-testing - Pycharm 单元测试交互式调试命令行不起作用
mysql - Bash 脚本 - 错误 1 (HY000) - 从数据库保存表
python - 当指定绝对路径 $/usr/bin/python 与 $ python 别名为相同路径时,如何会产生不同的结果?
javascript - 如何在 Pycharm/Intellij 中打印到 javascript 控制台
python - 错误 : Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly