How does the -e option work in the echo command?

The -e option in the echo command enables the interpretation of backslash escapes. This allows you to include special characters in your output. Some commonly used escape sequences with the -e option include:

  • \n - Newline
  • \t - Tab
  • \b - Backspace
  • \\ - Backslash
  • \" - Double quote

Example Usage

Here’s how you can use the -e option with some escape sequences:

echo -e "Line 1\nLine 2"

Output:

Line 1
Line 2

Using tabs:

echo -e "Name:\tJohn\nAge:\t30"

Output:

Name:	John
Age:	30

This feature allows for more formatted and structured output when using the echo command.

0 Comments

no data
Be the first to share your comment!