./ with sh

Difference 1.
If you want to execute a sh script, you can execute it regardless of whether the script has x (executable) permissions.
And ./ needs the x (executable) permission of the script to execute it.

 

Difference 2.
./a.sh will use the #!XXX shell in the first line of your script to execute the statement (not set, generally defaults to bash)
and sh a.sh will use sh to execute the statement

 

For the difference between sh and bash, see: http://huangqiqing123.iteye.com/blog/2254835

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326941398&siteId=291194637