1.shell between the operating system and the user. Responsible for interpreting the command line
2./etc/shells Record login system effectively supports Shell
3./ETC/PASSWD Finally, someone who can see the user's default shell
4. Directly enter the name of the shell to switch the shell
Records of the 5.shell command can be viewed with history history-c clear
Historical commands are stored in the. bash_history file
6.shell instructions can be replaced with alias alias = actual name
Cancel with Unalias alias
7.shell variables
<1> Define variable name = variable value to output variable value with echo $ variable name
Note: Using {$ variable name} can be associated with other variables such as echo{$ variable name}_ variable name Display variable Value _ variable name
<2> Assignment (double-cited, single-quote, anti-apostrophe)
Double cited: Agree $ reference Variable value output echo "xx xx $ variable name" displays XX xx variable value
Single cited: Do not agree with the value of the reference variable the same as the xx xx $ variable name
Anti-apostrophe (Tab key): (The backslash must be a command that can be run and its command combination) assigns the result of the command to the value
Read assignment: Read + variable name will need to manually enter a variable value to the variable name at the keyboard
If you read+ multiple variable names, separate the values of the input variables with a space.
More useful Commands read-p "Please input xxxxx:" + variable name
The scope of the <3> variable
The export variable name can declare a variable as a global variable (this variable can be used in a child shell)
be able to export XX = xxx at the time of definition
Use the unset variable name to eliminate
Operation of <4> variables
Cases:
$2 Add expr $X + $Y//plus no spaces on both sides show values + values
2 USD Multiply expr $X \* $Y
Tween
<5> Rules:
Variable name = variable value equal to cannot have spaces at both ends
Variable names can only be used in letters and numbers, where numbers cannot begin
If there are spaces that need to be enclosed in double or single quotes (the special character of the double-characters is the original meaning, the single-quote is only a character meaning. See <2>)
If necessary, you can use the escape character \
Ability to view the shell's pre-defined variables with the env command (env | more)
Variable PS1 is the input command, the preceding string can be changed by itself.
8. Redirection
Standard output redirection:
> Write, overwrite
>> Append
Standard input redirection:
< read files
Standard error 2>
9. Execution Environment settings
!/bin/bash
#为凝视
10. Run the shell
./full path/shell (current folder./shell)
Interpreter +shell (bash shell)
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Shell scripting Getting Started learning notes