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

How to execute script in centos

王林
王林Original
2020-05-17 11:51:1211113browse

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

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

/data/shell/hello.sh

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

cd /data/shell
bash hello.sh

or

cd /data/shell
sh hello.sh

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

cd /data/shell
. hello.sh

or

cd /data/shell
source hello.sh

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!

Statement:
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