Linux Application Programming Review

1. wc command file statistics, in two ways: (1) directly added to the file name wc test.txt (2) input redirection wc <test.txt

Wc is output three parameters, the file number of lines, number of words, the number of bytes

2. ls -l * .sh and ls -l * .sh difference (the difference between a space): List all .sh files for the former, the latter is to list all files that end in .sh space

If the execution error, an error message will list all the files and folder

 

 

3. parentheses and braces may be a combination of the command, after sharing a redirection, e.g. (ls -l * .sh; ls -l * .sh)> test.txt

4. | The left command uses standard output, | right of the command uses standard input eg: who -a | cat> userlist

5. shell variables

(1) environment variables: shell variables have been defined, such as the HOME, SHELL, the PATH
(2) user-defined variables:
• Variable names: Must begin with a letter, _ may be digital and other case-sensitive
• Variable type: shell variables are of type string
• variables do not need to declare in advance
• variable assignment: variable = value
• variable reference: $ var_name (can use the escape character \ and avoid replacing single quotes)

 

 6. The numerical calculation, a default is defined as a string variable

 

 If you want to assign numbers need to use the let command let x = 1

$ ((Y + 2)) represented by an operation expression

bc Float Calculator

t

 

 7. The command line parameters

 

 8. Wildcard: Indicates a pattern file name

 

 9. The command structure

• sequentially performed: using the same row; separate commands
• conditional execution: logical operators && and || partition command
cmd1 && cmd2 cmd1 if successful, is performed cmd2
cmd1 cmd2 if || cmd1 fails, execution cmd2

10. test test command (important)

 

 注意:0为真,1为假

Guess you like

Origin www.cnblogs.com/Kinghao0319/p/12104921.html