四、实验步骤及结果 1.shell脚本的建立和执行。 先创建shell 文件 touch hello.sh 再用vi编辑器编辑 Vi hello.sh 输入以下内容  再按esc ,再用shift 加 : 最后输入wq进行保存  执行文件 chmod u+x? /root/hello.sh  2.shell变量和位置参数、环境变量。 自定义shell变量  位置参数 打开vim 进入第一个创建的hello.sh   环境变量  3.bash的特殊字符。 再次用vim 进入hello.sh 我这里用的特殊字符,用于参数替代中,表示首字母小写,如果是两个逗号,则表示全部小写,注意,这个特性在bash version 4的时候被添加的。例子:   4.一般控制结构。 先创建一个文件,我的为first_if.sh 再用 vi first_if.sh 对文件进行编辑  再用bash? /root/first_if.sh 执行  5.算术运算及bash函数。 先touch suan.sh 再 vi suan.sh 再i   6. 综合编程:编写脚本测试实验室内容上课计算机所在网段(如:192.168.4.0/24)中哪些主机处于开机状态,哪些主机处于关机状态(for 版本) 事先说明,先用cmd查看本机的所在网段ipconfig 先创建 touch jc.sh 再编辑 vi jc.sh 再 i  最后,很简单,用bash /root/jc.sh 运行即可  |