Shell Learning 15 days (Shell characteristics 2/2) - 03day

(A) Command Queuing

Semicolon:; do not have the foregoing mechanism even though the command logic determination fails, subsequent commands will be executed as usual

&&:         comprising logic, the foregoing command is successful, the command will be performed later. For example, commonly used: ./configure&&make&&make install

 ||:              includes logic to determine, after the failure of the foregoing command, the command will be performed later.

 For example: mkdir / home / 11/22/33 && echo "ok ..." || echo "failed ..." - create success print ok, failed to create print failed

Extended: true and false command command, true i always returns true 0, false always returns false (non-zero)

Note: This will use the ampersand to make a simple induction:

command & background execution

command &> / dev / null redirection mixing (1 contains standard output, the error output 2)

command 1 && command2 command ordering logic determines

(B) Shell wildcard (meta-characters) , is not intended to represent

* Matches any number of characters ls in * find / -iname "* .txt" 

Here is a little special, * as a wildcard, you must enclose the find, you can not use quotation marks in the rest of the command

? Matches any character touch love loove live l7ve;? Ll l ve

[] Brackets match any one character [abc] [az] [0-9 ] [a-zA-Z0-9] [^ a-zA-Z0-9] ll l [io] ve ll l [^ az] ve  

() Execution (cd / boot; ls) in the sub-shell (umask 077; touch file1000) - this will not change the umask shell

} Set {    touch file (1..9) - 2-point digital intermediate 1-9     

     We have the following set of usage, the following three statements effect is the same:

 

Collection from the most outside layer of the multilayer start analyzing

\ Escape character, so metacharacters intended to return, but also allows an ordinary character becomes a character that has special meaning, to practice the following exercises:

Let metacharacters intended to return:

Let ordinary characters have special meaning:

The above phenomenon may have several places difficult to understand, easy to explain:

Escape character can escape the space, echo jian \ mei fact, the middle space could have been a symbol of division echo parameters, escaped after being turned into common spaces, so "jian mei" turned into an argument, so there is this folder It is created. There will usually say the escape character can be used as line breaks, in fact, not line breaks, to be exact is the newline escape character escaped.

 

 

 

 

 

Published 15 original articles · won praise 0 · Views 3041

Guess you like

Origin blog.csdn.net/xx_ay/article/details/104291341