Echo command

In unix what is the purpose to use echo with the option "-e"??
i.e echo -e

Questions by name is abhisek

Showing Answers 1 - 12 of 12 Answers

Manish Singh

  • Dec 2nd, 2012
 

-e option tells echo to consider the escape sequences in the statement.

e.g. echo "Without hyphen e option
It will be the same"
Output :: Without hyphen e option
It will be the same

echo -e "With hyphen e option
It will be different"
Output :: With hyphen e option
It will be different


  Was this answer useful?  Yes

PARUL SHARMA

  • Dec 8th, 2014
 

For better understanding consider the example

Code
  1. echo "welcome to geekinterview

  2. have a nice day"

  3. OUTPUT: welcome to geekinterview

  4. have a nice day

  5.  

  6. echo -e "welcome to geekinterview

  7. have a nice day"

  8. OUPUT: welcome to geekinterview

  9. have a nice day


here
for new line
for a tab etc.

  Was this answer useful?  Yes

Gaurav Khurana

  • Jan 9th, 2015
 

For me its printing -e also
[/home/gk]=> echo -e "is it different"
-e is it different
[/home/gk]=> echo "is it different"
is it different
My unix is Sun OS 5.10

  Was this answer useful?  Yes

abhinav

  • Jan 19th, 2016
 

echo -e /nabhinav
in this first a blank line will be printed after that in next line abhinav. -e is used for special symbols

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions