方法一:切换到shell脚本所在的目录(此时,称为工作目录)执行shell脚本
cd /data/shell ./hello.sh
方法二:以绝对路径的方式去执行bash shell脚本
/data/shell/hello.sh
方法三:直接使用bash 或sh 来执行bash shell脚本
cd /data/shell bash hello.sh
或
cd /data/shell sh hello.sh
方法四:在当前的shell环境中执行bash shell脚本
cd /data/shell . hello.sh
或
cd /data/shell source hello.sh
推荐教程:centos教程
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧
相关推荐