A system administrator wrote a shell script to display a two‐line status message:
STATUS="Update complete\nReview logs for details"
echo "$STATUS"
When executed, the output shows the literal \n instead of splitting into two lines. Which modification ensures the backslash‐escaped sequence is rendered as an actual newline?
Adding the -e option to the built-in that writes to standard output enables interpretation of backslash escape sequences, turning \n into a real newline. The -n option suppresses the trailing newline instead of interpreting escapes. Wrapping the string in single quotes prevents escape processing entirely. Redirecting via a here‐document delivers the literal content without interpreting backslashes.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the -e option do in the echo command?
Open an interactive chat with Bash
Why do single quotes disable escape sequence processing?
Open an interactive chat with Bash
What is a here‐document, and why doesn't it process escape sequences?