Challenge - 5 Problems
Single Quotes Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of single-quoted string with variable inside
What is the output of this Bash command?
Bash Scripting
name=World
echo 'Hello, $name!'Attempts:
2 left
💡 Hint
Single quotes prevent variable expansion in Bash.
✗ Incorrect
In Bash, single quotes preserve the literal value of each character inside them. Variables like $name are not expanded.
💻 Command Output
intermediate2:00remaining
Using single quotes with escaped single quote inside
What is the output of this Bash command?
Bash Scripting
echo 'It\'s a nice day'Attempts:
2 left
💡 Hint
Single quotes do not allow escaping single quotes inside them.
✗ Incorrect
In Bash, you cannot escape a single quote inside single quotes. This causes a syntax error.
💻 Command Output
advanced2:00remaining
Correct way to include a single quote inside a single-quoted string
Which command outputs exactly: It's a nice day
Attempts:
2 left
💡 Hint
To include a single quote inside single quotes, close, escape, and reopen.
✗ Incorrect
In Bash, to include a single quote inside a single-quoted string, you close the quotes, add an escaped single quote, then reopen the quotes.
💻 Command Output
advanced2:00remaining
Behavior of single quotes with command substitution inside
What is the output of this Bash command?
Bash Scripting
echo 'Today is $(date)'Attempts:
2 left
💡 Hint
Single quotes prevent command substitution.
✗ Incorrect
Single quotes preserve the literal string, so $(date) is not executed but printed as is.
🧠 Conceptual
expert2:00remaining
Why use single quotes for literal strings in Bash scripts?
Which statement best explains why single quotes are used for literal strings in Bash?
Attempts:
2 left
💡 Hint
Think about what happens to variables inside single quotes.
✗ Incorrect
Single quotes tell Bash to treat everything inside literally, with no expansions or special processing.