bash字符串,带/不带引号和单/双引号 [英] bash string with/without quote and single/double quote

查看:63
本文介绍了bash字符串,带/不带引号和单/双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ volume=vol1
$ echo $volume 
vol1

$ volume="vol1"
$ echo $volume 
vol1

$ volume='vol1'
$ echo $volume 
vol1

以上内容在bash脚本编写中有什么区别?都一样吗?

What is the difference between the above in bash scripting? All are one and same?

推荐答案

您可能会在 wiki .

简短答案:需要在 $ volume 周围加上引号.

Short answer: the quote are needed arround $volume.

这篇关于bash字符串,带/不带引号和单/双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆