Home > Operation and Maintenance > CentOS > How to execute script in centos

How to execute script in centos

王林
Release: 2020-05-17 11:51:12
Original
11370 people have browsed it

How to execute script in centos

Method 1: Switch to the directory where the shell script is located (at this time, called the working directory) and execute the shell script

cd /data/shell
./hello.sh
Copy after login

Method 2: Go with the absolute path Execute bash shell script

/data/shell/hello.sh
Copy after login

Method 3: Use bash or sh directly to execute bash shell script

cd /data/shell
bash hello.sh
Copy after login

or

cd /data/shell
sh hello.sh
Copy after login

Method 4: Execute bash in the current shell environment shell script

cd /data/shell
. hello.sh
Copy after login

or

cd /data/shell
source hello.sh
Copy after login

Recommended tutorial: centos tutorial

The above is the detailed content of How to execute script in centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template