Difficulty: Easy
Correct Answer:
Explanation:
Introduction / Context:
Command shells like bash and zsh expand wildcard patterns before executing commands. Understanding how each wildcard behaves prevents accidental file matches and enables precise selections when scripting or working interactively on large directories of files.
Given Data / Assumptions:
Concept / Approach:
The asterisk '' matches any string of characters, including the empty string. The question mark '?' matches exactly one character. Bracket expressions like '[ijk]' match exactly one character chosen from the set, and '[!ijk]' matches exactly one character not in the set. Therefore, only '' satisfies the requirement of matching zero or more characters.
Step-by-Step Solution:
Verification / Alternative check:
Use 'printf '%s\n' ' in an empty directory and observe that shells may pass the literal '' if 'nullglob' is not set; with 'nullglob' enabled, the pattern expands to nothing. This illustrates shell options but does not change the semantic that '' can match zero characters in principle.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing shell globs with regular expressions, and forgetting that some shells require options like 'nullglob' for empty expansions to vanish instead of leaving a literal asterisk.
Final Answer:
*
Discussion & Comments