1th Linux Command--echo

Source: Internet
Author: User

Function: Display a piece of text on the display, generally play the role of a hint.

Syntax: Echo [-ne][string] or echo [--help][--version]

Echo will send the input string to standard output I. The output strings are separated by white space characters, and a newline number is added at the end.

No line breaks: echo-n "character" or echo-e "character \c"

1. Echo Sample

Output sample

2. '-e' followed by ' \b ' removes all spaces between characters.

Note: The option '-e' in Linux plays the translation of the escape character backslash.

echo -e "Tecmint \bis \ba \bcommunity \bof \blinux \bnerds"

Output tecmintisacommunityoflinuxnerds

3. ' \ n ' line after '-e' in the place where it was encountered as a new row

echo -e "Tecmint \nis \na \ncommunity \nof \nlinux \nnerds" Output

Tecmint

Is

A

Community

Of

Linux

Nerds

4. Use the newline '\ n' With the Horizontal tab ' \t'

echo -e "Tecmint \tis \ta \tcommunity \tof \tlinux \tnerds"

Output Tecmint is a community of Linux nerds

5. '-e' followed by ' \v ' will add vertical tabs.

echo -e "\vtecmint \vis \va \vcommunity \vof \vlinux \vnerds"

Tecmint

Is

A

Community

Of

Linux

Nerds

6. Use the newline '\ n' With the Horizontal tab ' \t'

echo -e "\n\ttecmint \n\tis \n\ta \n\tcommunity \n\tof \n\tlinux \n\tnerds"

Output

Tecmint

is

A

Community

of

Linux

Nerds

7. You can use line break '\ n' with vertical tab '\v'

echo -e "\n\vtecmint \n\vis \n\va \n\vcommunity \n\vof \n\vlinux \n\vnerds"

Tecmint

Is

A

Community

Of

Linux

Nerds

8. '-e' followed by ' \ R ' to specify the carriage return character in the output. (LCTT: The characters at the beginning of a line will be covered)

echo -e "Tecmint \ris a community of Linux nerds"

Output

is a community of Linux nerds

-N does not output a newline character at the end.
-E Enable backslash escaping.
\b Backspace
\\ Reverse Slash
\ n New lines
\ r Enter
\ t Horizontal tab
\v Vertical tab

1th 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.