Linux basic command-echo prints content to standard output
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 ~] #