Shell base, input and output redirection

1, Shell features:

(1) Shell is a command interpreter, we write the commands into machine language can be recognized by the kernel, then the kernel calls the hardware to complete the appropriate action. After the operation is completed, the core operating results are returned to the kernel, Shell and then translated into machine language that we can understand the character.

(2) Shell is a powerful scripting language that is easy to write, easy to debug, functional, Shell scripting language interpreted, command Linux system can be called directly.

2, Shell script:

Shell script is a file that contains several lines and Linux Shell commands Shell script usually end in .sh, first row to specify which Shell interprets the user's system requires Shell program.

 

 3, the output redirection:

Do not output to the screen, but the output to a file (preserved at any time to view).

(1) Coverage method: command> filename

 

 (2) additional ways: command>> file name

 

 First the ls command, the command execution date, output date back to the results of ls query.

(3) error output redirection:

 

 No spaces between 2 and >>.

4, input redirection

But not through the file input via the keyboard for input.

wc command demonstrates:

 

Input redirection: 

Guess you like

Origin www.cnblogs.com/zhai1997/p/12052279.html