Quick Start shell variables

Temporary variable
Quick Start shell variables
open a new sh, temporary variable does not exist
Quick Start shell variables

In the shell script is running, the system will first look for the environment variable ENV
the environmental variable specifies the file (load order is usually / etc / profile ~ / .bash_profile ~ / .bashrc / etc / bashrc)

Implement local variables to take effect

Edit user variables file
Quick Start shell variablesQuick Start shell variables
effective immediately command
Quick Start shell variables
to open a new sh, variables exist

Quick Start shell variables
Ordinary users to switch variable does not exist
Quick Start shell variables
under realization / mnt script performed directly
edit user variables file
Quick Start shell variablesQuick Start shell variables
to display the PATH environment variable
Quick Start shell variables
to achieve global variables to take effect
editing system variable file
Quick Start shell variables

Quick Start shell variables
Effective immediately command
Quick Start shell variables
to switch the average user, variables exist
Quick Start shell variables
.


Double quotes: After the resultant non seen, it will first multivariate analysis, then the output
Quick Start shell variables
double quotes * to display the
Quick Start shell variables
following symbols unresolvable

Quick Start shell variables
Quick Start shell variables
Quick Start shell variables
Single quote: WYSIWYG
Quick Start shell variablesQuick Start shell variables
Quick Start shell variables
backslash (\): the escape character / escape character, Linux if you want an escape character echo play a role, we must use the -e option, and the escape character to use double quotes
Quick Start shell variables
backticks ( ``): replace command, the command commonly used for outputting the result to a variable
Quick Start shell variables
in another way
Quick Start shell variables
.


$ Symbol usage
editing the file
Quick Start shell variables
$ 1 $ 2 $ 3 is a sequence of transmission parameters, all $ * $ @ $ # is the number of parameters is the file name is $ 0

Quick Start shell variables
2. 3 transmission parameters. 1 br />! [] (Https://s1.51cto.com/images/blog/201909/03/3de2a851e6f55f838583eb550a3a1f8e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF, t_100, g_se, x_10, y_10, shadow_90, type_ZmFuZ3poZW5naGVpdGk =)
distinguish $ * $ @
$ * the parameter string as a whole (single string) returns

Edit the file
Quick Start shell variables
Quick Start shell variables
transfer parameters 2. 3. 1
br />! [] (Https://s1.51cto.com/images/blog/201909/03/8c91ff9728fa49f7de85cd9ee6df8c33.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i, color_FFFFFF, t_100, g_se, x_10, y_10, shadow_90, type_ZmFuZ3poZW5naGVpdGk =)
$ @ to each parameter as a string return
Quick Start shell variables
Quick Start shell variables
pass parameters 123
Quick Start shell variables
$! process PID background process of Shell last run of the last process (running in the background ID number)
Quick Start shell variablesQuick Start shell variables
$? end code of the last command run (return value) that is executing a command return value (final command to display the exit status of 0 means no error, any other value indicates an error)
Quick Start shell variables
Quick Start shell variablesQuick Start shell variables
$$ PID Shell itself (ProcessID, that is, the script runs the current process ID number)
Quick Start shell variablesQuick Start shell variables

Guess you like

Origin blog.51cto.com/14190777/2435958