1、创建一个shell脚本
root# vim shell_test.sh
在编辑器中输入如下:
#!/bin/sh
#上面的是保存的路径
pwd
date
echo"my shell"
2、shell脚本的运行
1、需要设置shell脚本的权限
chmod u+x shell_test.sh 只可自己执行
chmod ug+x shell_test.sh 自己及同组操作权限的人执行
chmod +x shell_test.sh 所有的人都可以执行
例如:
root# chmod +x shell_test.sh
2. 执行文件
root# source shell_test.sh 或者 root# sh shell_test.sh