![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
&HeiDi
这个作者很懒,什么都没留下…
展开
-
bash特殊字符2
小括号(()) 在括号中的命令列表,将会作为一个子 shell 来运行。 在括号中的变量,由于是在子shell中,所以对于脚本剩下的部分是不可用的。父进程,也就是脚本本身,将不能够读取在子进程中创建的变量,也就是在子shell 中创建的变量。如: #!/bin/bash a=123 ( a=321; ) echo "$a" #a的值为123而不是321,因为括号将判断为局部变量 运行测试: ...转载 2020-02-25 22:35:17 · 119 阅读 · 0 评论 -
实验楼shell笔记-特殊符号1
命令分隔符(分号;) #!/bin/bash echo hello; echo there filename=ttt.sh if [ -e "$filename" ]; then # 注意: "if"和"then"需要分隔,-e用于判断文件是否存在 echo "File $filename exists."; cp $filename $filename.bak else...原创 2020-02-24 22:16:47 · 117 阅读 · 0 评论