shell脚本的基础知识

## 1.什么是shell ##
脚本中命令的解释器


## 2.shell脚本的意义 ##
1.记录命令执行的过程和执行逻辑,以便以后重复执行
2.脚本可以批量处理主机
3.脚本可以定时处理主机


3.如何创建shell脚本
#!/bin/bash
##幻数

shell脚本的基础知识

打开脚本后 自动出现

shell脚本的基础知识

 4.如何执行shell脚本


1).手动在环境中开启指定解释器
sh script.sh

shell脚本的基础知识
2).直接在当前环境中运行shell中的指令不开启新的shell
source script.sh
. script.sh

shell脚本的基础知识
3).开启脚本中指定的shell并使用此shell环境运行脚本中的指令
chmod +x script.sh
/xxx/xxx/script.sh
./script.sh

 shell脚本的基础知识

 5.如何对脚本进行调试
sh -x /mnt/westos.sh

上一篇:shell脚本加密教程


下一篇:执行node.js脚本报错windows script host