Raspberry Pi_Eng_10.4.2 “echo” Command


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


10.4.2  "echo" Command

 

This command displays the specified text on standard output. It is not necessary for common task, but is often used to display information about various progresses when writing bash scripts.

 

[Command Format]

echo  [option]   [string]

 

[Command Overview]    

   This displays the specified text on standard output.

   User privilege          -- Normal user.

 

[Detail Description]

   [string] is expressed in the format "XXX"

 

[Main Option]

-n

do not output the trailing newline

-e   

enable interpretation of backslash escapes

-E   

disable interpretation of backslash escapes (default)

--help

display this help and exit

 

[Used Example]

In Shell, let's simply execute the echo command with the string "This is Raspberry Pi System" as follows. You can see that the specified string is displayed in the output as it is.

pi@raspberrypi ~ $ echo "This is Raspberry Pi System"

This is Raspberry Pi System

 

This time, we will try to express the string in several lines. To move to a new line in this command, you must use "n" to represent the new line. The following example shows that the specified string after the new line will be displayed on the second line.

pi@raspberrypi ~ $ echo -e "This is Pi System nFrom this, the new line begins"

This is Pi System

From this, the new line begins