Explain `echo -e` command.

0135

The echo -e command in Bash is used to print text to the terminal while enabling the interpretation of escape sequences. Here's a breakdown:

  • echo: This command outputs the strings you provide to the terminal.

  • -e: This option allows the interpretation of backslash escapes. Without -e, escape sequences like \n (new line) or \t (tab) would be printed literally instead of being processed.

Common Escape Sequences

  • \n: New line
  • \t: Horizontal tab
  • \\: Backslash
  • \": Double quote

Example

echo -e "Hello\nWorld"

This will output:

Hello
World

If you have more questions or need further examples, let me know!

0 Comments

no data
Be the first to share your comment!