1. Specify the script interpreter at the beginning
#!/bin/bash or #!/bin/sh
2, and then add version information, etc.
#Date: 2016-12-27
#Author: sadoc.blog.51cto.com
#Mail: [Email protected]
#Function: Scripting Features
#Version: Version
The script is named after the. sh extension
"source" and " . "Load the executed script, the variable (including function) value in the script after the end of the script still exists in the current shell,"sh" and" bash "is not
Global variables:/etc/profile variables under this directory all users are in effect
Current User variables:. bash_profile variables are only valid in the current user mode
Export variables with export
Modifying a Set Variable environment requires "." The "source" load takes effect
For example: Vim /etc/profile or . Bash_profile added
Export A=nihao
The difference between a single quote, a double quote, and a non-quoted variable:
Single quotes:
That is, the single quote content is output as is, or what you see in single quotation marks.
Double quotes:
If there are commands and variables inside the double quotes, the variables and commands are parsed out and then the final content is output.
No quotation marks:
Output of the content, the string containing the space will be treated as a whole output, if there is a command or variable, will be the command variable parsing output, if the string with a holding and other special characters, it is not fully output, need to use double quotation marks.
Linux execution script specification and execution commands