Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux basic command-echo prints content to standard output

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Echo

The echo instruction can output the content to standard output, dividing the string with white space, followed by a newline.

The scope of application of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.

1. Grammar

Echo [- neE] [arg...]

2. List of options

Option

Description

-n

The output string does not wrap

-e

Dealing with some special characters

\ a buzzer alarm

\ b Delete the previous character

\ C finally, there is no line change.

\ e output esc characters

\ f Wrap, the cursor stops in the same place

\ nWrap

\ r move the cursor to the first line without wrapping

\ t horizontal tab

\ v Vertical tab

\\ output\

The ASCII character represented by\ 0nnn octal nnn

\ xHH the ASCII character represented by the hexadecimal number HH

-E

Disable escape interpretation

3. Examples

1) use "\ f" line feeds

[root@localhost ~] # echo-e "hello\ fworld" / / the-e option must be used, and the cursor is still at the end after\ f wrapping

Hello

World

[root@localhost ~] #

2) use "\ n" line feeds

[root@localhost ~] # echo-e "hello\ nworld" / / the-e option must be used,\ nAfter a line break, the cursor is at the beginning

Hello

World

[root@localhost ~] #

3) output ascii characters

[root@localhost ~] # echo-e "\ x31" / / 31 in hexadecimal, converted to 49, the ascii character represented is 1

one

[root@localhost ~] #

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report