1. Double quotation marks: Echo *: output directory list, Echo "*": Output *.
Echo * | SED's // \ n/G': vertical line output (replace spaces with carriage return ).
Double quotation marks can be used to reference any character or string except the characters $, ', and.
2. Use single quotes: Echo 'hello' $ value' $ ttle "Lee" ': Output: Hello 10 $ ttle "Lee ", the $ and "" symbols are ignored.
The single quotes are similar to double quotes. The difference is that shell ignores any reference values.
3. backquotes are used to set the output of system commands to variables. For example, Echo 'date', where date is the system command.
Date' + % A the % E of % B % y': the output date is structured, and the output result is: Wednesday the 12 of September
2012
Datetime = 'date' + % A the % E of % B % y': returns the value of the command output to the variable in reverse quotation marks.
Echo "the time is 'date'": Double quotation marks are added. If shell encounters a quotation mark, date is used as the command for execution.
4. backlash prevents shell from misunderstanding, that is, shielding its special meaning: Echo \ *: output is *; otherwise, output is directory
Octal output: ECHO-e "this is \ 0100": This is @
5. the expr command is generally used as an integer, but can also be used as a string. The general format is:
1) expr argument operator argument
For example, the expr 10 + 10 output is 20.
Expr 10*10: The output is a syntax error. Here, you must use the backslash: expr 10 \ * 10 to output 100.
Expr $ leeboy = "9": determines whether leeboy is 9. 1 is returned correctly.
2) You can use expr to calculate the number of characters in the string by specifying the colon option:
Leeboypolictttttetttt.doc, expr $ leeboy: 't* ': the output result is 5;
Expr $ leeboy: '. *' the output result is 14 characters in total.
3) In expr, you can use the string matching operation to extract fields, which can be used to extract file affiliated names:
Leeboy = leeboywang, expr $ leeboy: '\ (. * \) Wang'
The output is leeboy.
Leeboypolictext.doc, expr $ leeboy: '\ (. * \ mongo.doc'
The output is text.
6. The output of ECHO 'it sells $19.3 'is: It sells $19.3 single quotes will ignore $.
Echo "It sells $19.3" outputs $ or special characters in it sells 9.3 double quotation marks.
Echo "It sells \ $19.3" output: It sells $19.3 backslash can shield special characters.