执行shell脚本的方式

执行shell脚本的方式

  1. bash script.sh 或 sh scripte.sh ,文件本身没权限执行,没 x 权限,则使用的方法,或脚本未指定 shebang ,重点推荐的方式

  2. 使用 绝对/相对 路径执行脚本,需要文件含有 x 权限

  3. source script.sh 或者 .script.sh ,代表 执行的含义,source等于点.

  4. 少见的用法,sh < script.sh


欢迎关注我的CSDN个人博客知乎