What is the purpose of '-e' in echo?

The -e option in the echo command enables the interpretation of backslash escapes. This means that special characters, such as newline (\n), tab (\t), and others, can be used to format the output.

Example:

echo -e "Hello\nWorld"

Output:

Hello
World

In this example, the -e option allows \n to be interpreted as a newline character, resulting in "Hello" and "World" being printed on separate lines.

Without the -e option, the backslash escape sequences would be treated as plain text:

echo "Hello\nWorld"

Output:

Hello\nWorld

In summary, the -e option is used to enable the interpretation of escape sequences in the string passed to echo.

0 Comments

no data
Be the first to share your comment!