Intermediate Linux & Shell Scripting
Q61 / 100

What is the difference between "*.txt" and ".*" as wildcard patterns in bash globbing?

Correct! Well done.

Incorrect.

The correct answer is A) "*.txt" matches any filename ending in ".txt" (excluding hidden files by default), while ".*" matches any filename starting with a dot, which includes hidden files like ".bashrc" as well as the special entries "." and ".."

A

Correct Answer

"*.txt" matches any filename ending in ".txt" (excluding hidden files by default), while ".*" matches any filename starting with a dot, which includes hidden files like ".bashrc" as well as the special entries "." and ".."

Explanation

Bash glob patterns don't match dotfiles with "*" unless explicitly using a pattern starting with "."; ".*" matches anything starting with a dot, including "." and ".." themselves, which is a common gotcha when using "rm .* " accidentally.

Progress
61/100