Centos怎么执行脚本

方法一:切换到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

方法五:在其他的shell环境中执行bash shell脚本

复制代码
bash /data/shell/hello.sh

或

复制代码
sh /data/shell/hello.sh

推荐教程:centos/" target="_blank">centos教程

以上就是centos怎么执行脚本的详细内容,更多请关注CSDN其它相关文章!

相关推荐
还卿一钵无情泪3 小时前
Unsloth 微调 构建自己的大模型 没有GPU也能微调
linux·开发语言·人工智能·python·大模型·nlp·unsloth
高山有多高3 小时前
【Linux笔记】IO模型
linux
不会就选b4 小时前
Linux之TCP理论<1>
linux·运维·服务器
小π军5 小时前
操作系统面试题
java·linux·服务器
倔强的石头1065 小时前
应用账号最小权限实践:读写账号、报表账号、运维账号分层
java·运维·开发语言
Lsetea6 小时前
curl用IP测试HTTPS报证书不匹配:--resolve与Host头别混用
linux·https·ssl证书·openssl·curl
Hao2856 小时前
Windows11 下把 WSL2 Ubuntu 26.04 装到 D 盘完整
linux
Android系统攻城狮6 小时前
Linux Gstreamer深度解析之gst_audio_encoder_get_frame_samples_min调用流程与实战(六十)
linux·运维·服务器·音视频·gstreamer音视频·音视频进阶·gstreamer音视频进阶
_upupup7 小时前
Linux中的自动化构建——make/Makefile
linux·运维·自动化
HEJOO97 小时前
Linux 设备驱动系列——使用全局工作队列
java·linux·算法