Linux command Echo

Source: Internet
Author: User
Tags echo display

1) Echo Display string//This function is really like the printf statement inside C
The normal string can be entered directly after the echo string, but so when to output some words such as \ will have a problem (this writing is treated as a second line to filter out, to output a \ must play \ \, with the C language printf output requirements), it is generally best to use ' string ' or ' String "format, so that even the \ can also be output, convenient and intuitive.
#echo Hello World
Hello World
#echo hello\ World
Hello World
#echo hello\\ World
Hello\ World
#echo ' hello\\ world ' or: echo "hello\\ World"
Hello\\ World
2) Echo's escape display: Plus-e parameter//followed by comment
Output Multiple lines
#echo-E ' Hello\nworld '
Hello
World
Output ASCII characters: Echo-e \nnn (NNN is ASCII character octal code, non-octal will be printed in literal sense)
#echo-E ' \61 \62 \101 \141 '
1 2 A AASCII word appended existsAmerican Standard Code For information interchange, ASCII; In a computer, all data is stored and computed using a binary number representation (because the computer represents 1 and 0, respectively, with high and low levels), such as A, b , C, D such as 52 letters (including uppercase), and 0, 1 and other numbers and some commonly used symbols (such as *, #, @, etc.) are stored in the computer is also used to represent the binary number, and specifically which binary numbers to indicate which symbol, of course, everyone can contract their own set (this is called code), And if you want to communicate with each other without causing confusion, then everyone must use the same coding rules, so the United States, the Standardization organization has introduced the so-called ASCII code, Uniform rules of the above-mentioned symbols with which binary number to represent.escape character appended exists Escape String(Escape Sequence) is also known as the character entity (Character entity). In HTML, there are two reasons for defining an escaped string: The first reason is that symbols such as "<" and ">" are already used to represent HTML tags, so they cannot be used directly as symbols in text. In order to use these symbols in an HTML document, you need to define its escape string. When the interpreter encounters such a string, it interprets it as a real character. When you enter an escaped string, you strictly follow the rules for letter-case. The second reason is that some characters are not defined in the ASCII character set, so you need to use an escape string to represent them. \ ' Single quotation mark
\ double quotation marks
\ \ counter Slash
Space-out character
\0nnn octal number
\a Sound Notes
\b Backspace
\f Page Break
\ n line break
\ r return character
\ t Horizontal tab
\v Vertical Tab
\x hexadecimal characters

Linux command Echo

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.