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其它相关文章!

相关推荐
前进的李工7 小时前
Agent 学习笔记 02:Harness 与工作流怎么理解
笔记·学习·agent·工作流·harness
云宏信息7 小时前
超融合和存算分离怎么选?从性能、可靠性、扩展、成本四个维度讲述如何精准匹配架构选型 | 附企业降本轻量云方案
运维·服务器·架构·云计算
mounter6257 小时前
深入理解 gccrs:GCC 如何实现 Rust 编译器,以及编译 Linux 内核面临的挑战
linux·驱动开发·rust
垚垚学技术_聚焦云原生7 小时前
Ansible Playbook 进阶:when 条件、loop 循环、handlers 触发器落地
linux·ansible·自动化运维·devops
无足鸟ICT8 小时前
【RHCA+】type命令(判断命令类型)
linux·ssh·bash
咸鱼梦想家π8 小时前
Linux开发工具(下)
linux·运维·服务器
LHICOD8 小时前
Linux-1
linux·ip·vmware·虚拟机·cmd·ping
海鸥-w8 小时前
数据库冗余字段设计笔记
java·数据库·笔记·oracle
滴啦嘟啦哒9 小时前
【具身笔记】【原理探究】一、对PI05源码的实践笔记
笔记·python·vla·具身
云飞云共享云桌面9 小时前
机械制造研发部门:一台SolidWorks云主机替代 10 台传统图形工作站
运维·服务器·网络·3d·自动化·制造