1
A
回答
0
#this will set var value with some/path,
#no matter var is empty or not (overwrite)
var='some/path'
# this will set value of var to "some/path"
#only if var is empty/or not declared yet.
var=${var:-"some/path"}
0
var='some/path'
将始终设置VAR一些/路径
var=${var:-"some/path"}
将只设置VAR到VAR如果如果尚未设置一些/路径。如果设置,它的值不会改变。
相关问题
- 1. Shell脚本声明日期变量
- 2. 如何在shell脚本中声明一个常量变量?
- 3. 在java中声明变量的方法
- 4. 如何在Linux shell脚本中声明?
- 5. 为什么shell脚本变量声明没有前面的`$`?
- 6. 在方法参数中声明变量
- 7. c#方法声明变量
- 8. C++方法变量声明
- 9. Ruby方法变量声明
- 10. unix shell脚本变量声明 - 找不到命令
- 11. 声明类方法中的新变量
- 12. Javascript中的变量声明方法
- 13. 在JMeter bean shell脚本中获取类型化的变量声明错误
- 14. 错误在Bash Shell脚本IF声明
- 15. Shell脚本变量
- 16. 主机/变量未声明问题 - 但脚本中没有声明/变量
- 17. 无法使用变量在shell脚本
- 18. 访问变量到方法声明中
- 19. 无法正确地在ssh会话中声明shell变量
- 20. 的Bash shell脚本变量
- 21. 带变量的Shell脚本
- 22. shell:如何在shell中声明volatile变量
- 23. JavaScript变量声明的不同方法
- 24. 声明变量的不同方法?
- 25. 方法 - 本地内部类不能使用在方法中声明的变量
- 26. Chrome拒绝在注入的脚本中声明变量
- 27. 在脚本中检测未声明的变量
- 28. 在Unix脚本的不同文件中声明使用变量
- 29. 如何列出在bash脚本中声明的变量?
- 30. 在APPLICATION中声明所有常量变量的最佳方法
下面是另一种方式:':$ {var:=“some/path”}' –