【1.2】Linux学习—shell变量

版权声明:版权所有,翻版必究【Kevin】 https://blog.csdn.net/weixin_30935137/article/details/81156186

定义变量:定义变量时,变量名不加美元符号

  1. 命名只能使用英文字母,数字和下划线,首个字符不能以数字开头

  2. 中间不能有空格,可以使用下划线(_)

  3. 不能使用标点符号

  4. 不能使用bash里的关键字

使用变量:只需要在变量名前面加美元符合即可

[wujiadong@hcu05 linux_peixun]$ your_name="wujiadong"
[wujiadong@hcu05 linux_peixun]$ echo $your_name
wujiadong
[wujiadong@hcu05 linux_peixun]$ echo ${your_name}
wujiadong

删除变量:使用 unset variable_name

猜你喜欢

转载自blog.csdn.net/weixin_30935137/article/details/81156186
今日推荐