1) Use of shell if
Determine if a.txt exists
If [-F a.txt]
2) Execution result of the command
Assign the execution result of the command to the variable, the following two methods are the same
time=$ (date +%y%m) time= ' date + $Y%m '
3) Find out what we need.
This can be used to determine the execution result of the command, and whether the result of the selected file or command has a corresponding value
-o means that the match is just the part we care about, plus-p indicates that the following pattern is a Perl-compatible regular expression because Pcre supports 0 wide assertions
[Email protected] by-uuid]# Ifconfig | Grep-p Em1[[email protected] by-uuid]# ifconfig | Grep-o Em1[[email protected] by-uuid]# ifconfig | Grep-op EM1
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/88/9A/wKiom1f8q-uSRVCIAAAjkEGHYXk331.png "title=" Sogou 20161011170652.png "alt=" Wkiom1f8q-usrvciaaajkeghyxk331.png "/>
4) filter lines that begin with uppercase letters that end in lowercase letters
[Email protected] by-uuid]# egrep ^[a-z].*. [A-z]$ Zhang.txt
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/88/97/wKioL1f8rd-jYpfWAAAOe5AT6W0311.png "title=" Sogou 20161011171553.png "alt=" Wkiol1f8rd-jypfwaaaoe5at6w0311.png "/>
This article is from the "Court of the Odd Tree" blog, please be sure to keep this source http://zhangdl.blog.51cto.com/11050780/1860749
I have encountered a summary of the shell trivia points