[Shell] Shell script is executed sh

 

 

 

You must write this

#!/bin/bash -ilex

 

 

Two, a.sh

 The above two problems are due to dos format .sh file format. The linux unix format can only be performed in the format of the script. Because press the Enter key at a dos / window actually entered the "carriage return (CR)" and "line feed (LF)", and the lower Linux / unix press the Enter key input only "line feed (LF)", so sh modified files in each line will be more than a CR, so the error will not be found when the command runs under Linux.
        We can see the format of the script file by using the command: vim a.sh enter the editing interface file, as shown below.
 

  Direct input ":", then the ":" After entering "set ff" as shown in FIG.

        Enter to see the script format, as shown below, can be seen in FIG current script format is dos.

         We need to format to unix, by typing ": set ff = unix", can enter ": set fileformat = unix" as shown in FIG.

    After completion of the input, the transport format to complete the handover. Then we enter ": set ff" to view format, as shown below, you can see a map of the current script format into what we want "unix" a.

 

carried out

sh a.sh

 

 

Third, the recommended
BUILD_ID = dontKillMe nohup ./a.sh Start> ./catalina.out 2> & 1 &
echo -e "script execution ends == ================== ================ $ BUILD_ID "

 

Published 53 original articles · won praise 0 · Views 814

Guess you like

Origin blog.csdn.net/G971005287W/article/details/105210386