Home >Operation and Maintenance >Linux Operation and Maintenance >How to run .sh file under Linux system

How to run .sh file under Linux system

coldplay.xixi
coldplay.xixiOriginal
2020-12-24 16:45:2839171browse

How to run the .sh file under Linux system: first enter the absolute path of the file [/root/datelog.sh]; then cd to the directory of the [datelog.sh] file and execute [./ datelog.sh].

How to run .sh file under Linux system

The operating environment of this tutorial: Windows 7 system, Linux 7.3 version, Dell G3 computer.

How to run .sh files under Linux system:

The first method (this method requires chmod to make the file meet the execution conditions (x): chmod u x datelog .sh):

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

How to run .sh file under Linux system

2. cd to the directory of the datelog.sh file, and then execute ./datelog.sh

How to run .sh file under Linux system

The second method (this method does not work The file needs to have executable permissions to run):

1. Just add the file name to sh in the file path, sh datelog.sh

How to run .sh file under Linux system

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

How to run .sh file under Linux system

Related learning recommendations: linux video tutorial

The above is the detailed content of How to run .sh file under Linux system. 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