文章目录
前言
贫穷自在,富贵多忧。
目标
在日常的开始中在调试程序的时候总是要重复的敲一些命令,浪费了时间和精力,有没有快捷的方式实现那个,答案是肯定的,下面我来介绍下如何自定义脚本来执行特定命令。
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
本文介绍了如何通过创建shell脚本简化日常任务,包括使用`bash`、`source`、`./test.sh`等方式执行,以及脚本的元素和权限设置。详细讲解了如何在`/root`目录下创建目录并编写可执行的`test.sh`,并提供执行示例。
4280

被折叠的 条评论
为什么被折叠?



