1. 使用文本编辑器来创建文本文件
2. 运行脚本
脚本规范
#!SHEBANG CONFIGURATION_VARIABLES FUNCTION_DEFINITIONS MAIN_CODE
shell脚本示例
#!/bin/bash # ------------------------------------------ # Filename: hello.sh # Revision: 1.1 # Date: 2019/05/26 # Author: GUO # Email: 1428778457@qq.com # Website: www.magedu.com # Description: This is the first script # Copyright: 2017 wang # License: GPL # ------------------------------------------ echo “hello world”
检测脚本中的语法错误
bash -n /path/to/some_script
调试执行
bash -x /path/to/some_script
原文:https://www.cnblogs.com/guopeilin/p/10926759.html