Home >Operation and Maintenance >CentOS >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!