Challenge - 5 Problems
Escape Character Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this Bash command?
Consider the following command in a Bash shell:
What will this command output?
echo "Hello\nWorld"What will this command output?
Bash Scripting
echo "Hello\nWorld"Attempts:
2 left
💡 Hint
Remember that double quotes allow some escape sequences, but \n is not interpreted by echo by default.
✗ Incorrect
In Bash, echo does not interpret \n as a newline unless used with -e option. So the output is the literal string with \n.
💻 Command Output
intermediate1:30remaining
What does this command print?
What is the output of this Bash command?
echo -e "Hello\nWorld"Bash Scripting
echo -e "Hello\nWorld"Attempts:
2 left
💡 Hint
The -e option enables interpretation of backslash escapes.
✗ Incorrect
With -e, echo interprets \n as a newline, so it prints Hello then a newline then World.
📝 Syntax
advanced2:00remaining
Which command correctly prints a backslash character?
You want to print a single backslash character (\) in Bash using echo. Which command will do this correctly?
Attempts:
2 left
💡 Hint
Backslash is an escape character, so you need to escape it to print it literally.
✗ Incorrect
Inside double quotes, \\ becomes a single backslash. Option A prints one backslash correctly.
🔧 Debug
advanced2:00remaining
Why does this command fail to print a newline?
This command is intended to print two lines:
But it prints the literal string instead. Why?
echo "Line1\nLine2"But it prints the literal string instead. Why?
Bash Scripting
echo "Line1\nLine2"Attempts:
2 left
💡 Hint
Try adding an option to echo to enable escape sequences.
✗ Incorrect
By default, echo prints the string literally. The -e option enables interpretation of escape sequences like \n.
🚀 Application
expert2:30remaining
How to assign a variable with a literal backslash in Bash?
You want to assign a variable named path with the value C:\Users\Admin (including backslashes) in Bash. Which assignment is correct?
Attempts:
2 left
💡 Hint
Single quotes prevent escape sequence interpretation in Bash.
✗ Incorrect
Single quotes preserve backslashes literally, so option C assigns the exact string with backslashes.