Recall & Review
beginner
What does the character class
[a-z] represent in bash scripting?It matches any single lowercase letter from 'a' to 'z'. Think of it like choosing any letter from a small box labeled with all lowercase letters.
Click to reveal answer
beginner
How does
[0-9] help in pattern matching?It matches any single digit from 0 to 9. Imagine it as picking any number from 0 through 9 in a list.
Click to reveal answer
intermediate
What would the pattern
[a-z0-9] match?It matches any single lowercase letter or digit. Like choosing one item from a mixed box of letters and numbers.
Click to reveal answer
beginner
In bash scripting, how do character classes improve searching text?
They let you match groups of characters easily without listing each one. For example, <code>[a-z]</code> matches any lowercase letter, saving time and effort.Click to reveal answer
beginner
True or False: The pattern
[a-z] matches uppercase letters.False. It only matches lowercase letters from 'a' to 'z'. Uppercase letters require
[A-Z].Click to reveal answer
What does the pattern
[0-9] match in bash scripting?✗ Incorrect
[0-9] matches any single digit between 0 and 9.
Which pattern matches any lowercase letter or digit?
✗ Incorrect
[a-z0-9] matches any lowercase letter or digit.
Does
[a-z] match the letter 'G'?✗ Incorrect
[a-z] matches only lowercase letters, so 'G' is not matched.
What is the benefit of using character classes like
[a-z] in bash scripts?✗ Incorrect
Character classes simplify matching any one character from a set, making scripts easier to write.
Which pattern matches any uppercase letter?
✗ Incorrect
[A-Z] matches any uppercase letter from A to Z.
Explain what character classes like
[a-z] and [0-9] do in bash scripting.Think about how you pick letters or numbers from a group.
You got /4 concepts.
Describe a simple example where you would use
[a-z0-9] in a bash script.Imagine checking if a character is a letter or number.
You got /4 concepts.