- Consider the next, just own a little record, according to their own situation to record it, follow up with new things to add at any time. Oh, yes.
First, getting started with common sense
1. Several commands
1)!n: Executable nth command in history
2) Set: View all environment variables
3) Env: can view the current environment variables
4) unset (environment variable) (note: If the environment variable is defined in the parent process, the variable cannot be deleted in the child process
5) Alias: Alias, simple set up your command, the following using alias to implement a simple HTTP service
The effect is similar:
Note: If you need to set the restart is still in effect, you can write alias to ~/.BASHRC this is the same as setting ~/.VIMRC, requires immediate effect please use the source (.) ~/.BASHRC
6) WC: Statistic Quantity
Common options:
-L (line): Count rows
-M (chars): Count characters
-W (words): Number of statistical words
Like what:
Test Case:
1 # !/bin/bash 2 " number of rows: " 3 echo $ (WC-l test.txt) 4" number of characters:"5 echo $ (WC-
m test.txt)
6
"
number of words:
"
7 echo $ (wc-w test.txt)
Output:
7) Sort: sort
8) Cut: Cut characters by format
9) printf: printing
Uniq: To repeat the line
One) TR: replace character (or use SED)
Split:
SED: See the following simple regular expression description
AWK: See the following simple regular expression description
2. Set path, command (library) lookup paths
1) Assume that the test.sh is created under the/home/test/path
1 # !/bin/bash 2 " run successfully, set path successfully! "
2) 1. Modify the permissions of test: chmod +x test.sh;
2. Set path= "$PATH": "$PWD"
3.echo $PATH View the results of our settings
Without an accident, you can see the result:
3) Setup succeeds, you can go to any path, execute test.sh
3. Redirection instructions
4. Operator description
5. Several special variables
6.Test
7. Get the result of the command in the shell
8. Simple Regular Expressions
9.shell syntax
1) variables
2) Process Control
3) function
1. Simple functions
2. With the parameter function
4) file contains
- Resources:
- Http://www.imooc.com/u/279399/courses?sort=publish (VIDEO)
- Http://c.biancheng.net/cpp/view/6994.html
- http://www.92csz.com/study/linux/
Shell Programming----Notes