This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the bash category.
Last Updated: 2023-03-28
Imagine you have a shell script as follows:
pattern=$1 grep $pattern
$pattern is not set,
grep will act oddly, the same as if it is called with no arguments.
Compare to this:
Now grep is called with a blank string even if
$pattern was never set, and the
line and will work as a pass-through, returning every line.