Original text: blog.csdn.net/hpf247/arti…

There are two ways to run the. Sh file on Linux. For example, I have a datelog.sh file in the root directory

First (this method requires chmod to make the file executable (x): chmod u+x datelog.sh):

1, In any path, enter the absolute path of the file /root/datelog.sh to execute the file (under permission of course)

2. Go to the datelog.sh directory and run the./datelog.sh command

Second (this method does not require the file to have executable permissions to run) :

1. Add sh datelog.sh to the file name in the file path

2. In any path, add sh to the file path and file name: sh /root/datelog.sh