How to write a shell execution script

 1. Create a file

touch abc.sh (Linux does not recognize the suffix of the file, and the .sh suffix is ​​added for the convenience of classification, so that the user can know that it is a shell script at a glance)

2. Edit the file content and write the code

#!/bin/sh

echo "hello world!"

(The first line is required, to formulate the place where SHELL is executed,

The beginning of the second line is where you write your own code.)

3. Change the file permissions to make the file an executable file

chmod + x  abc.sh

4. Execute the file

./abc.sh


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324820732&siteId=291194637