文章目录
前言
贫穷自在,富贵多忧。
目标
在日常的开始中在调试程序的时候总是要重复的敲一些命令,浪费了时间和精力,有没有快捷的方式实现那个,答案是肯定的,下面我来介绍下如何自定义脚本来执行特定命令。
1 连接工具进入目录,创建执行目录和文件
[root@localhost ~]# pwd
/root
[root@localhost ~]# mkdir scrip
[root@localhost ~]# cd scrip/
[root@localhost scrip]# touch test.sh
[root@localhost scrip]# ll
##授权可执行
[root@localhost scrip]# chmod u+rx test.sh
[root@localhost scrip]# ll
total 0
-rwxr--r--. 1 root root 0 Jan 14 05:23 test.sh
2 shell脚本要素解释
#!/bin.bash & /etc/shell 执行那些集合
# 该 sh 解释
脚本
例子
#!/bin.bash
# 查询日志
cd /opt/www/bs/service
tail -200f nohup.ot