Linux EXEC Usage Summary

Source: Internet
Author: User

Summary of exec usage in Linux

Summarize a table first:

exec command

action

exec ls

ls Span style= "font-family: the song Body;" >, No return to the original after the end

exec  <file

exec standard input

exec  >file

exec  3<file

read into fd3 Span style= "font-family: the song Body;" > in

sort  <&3

fd3

exec  4>file

will be written to file Span style= "font-family: the song Body;" > in

ls  >&4

ls fd4

exec  5<&4

create fd5

EXEC 3<&-

Close fd3

1. exec Execution program

Althoughexecand theSourceis executed directly in the parent process, butexecthis andSourceThere's a big difference,Sourceis to performShellscript, and will return to the previousShell. andexecexecution does not return to the previousShell, but directly to the previous landingShellas a procedure, it is copied on the line.

2. exec Example

1) Exec </dev/tty1//function: Use the serial terminal display character as input to exec

For example, in the key input driver: After executing exec </dev/tty1, press the key on the Development Board, the serial terminal displays the characters pressed,

Then press the OK key on the Development Board, the command will be executed, and the confirmation key will be invalid on the computer serial terminal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.