- 变量:存放可以变换的内容
- 变量:类似于我们学习的x+y=10 已知x=20 问y=? 未知数/变量
- 变量:内存中一段空间,通过变量名字访问与使用
[root@localhost shell]# girl=21
[root@localhost shell]# echo $girl
21
2、变量取值
通过$符号取值
[root@localhost shell]# girl=21
[root@localhost shell]# echo $girl
21
3、变量命名规则与要求
01、不能用数字开头
02、不推荐包含特殊符号 $ ! ''
03、变量名字推荐使用多个单词,连在一起使用,见名知义
04、变量名字风格 驼峰
05、推荐多个单词通过下划线连接即可
二、分类
变量分类
环境变量 | 在脚本中获取系统信息,系统内置 |
普通变量 | 脚本中大量使用 |
特殊变量 | 位置变量 |
状态 | |
变量子串(变量加工) | |
变量扩展 |