This isdesign incorporates a safe design.
approach, considering the use of nullglob would beas the safe default for commands that areyield void results when argument isprovided with void arguments. This isHowever, this default behavior may not the case whithbe ideal for commands like ls.
  While nullglob isproves useful in scripts, butit is not entirely safe unless you replace ls byis replaced with a function like this , as demonstrated below:
myls() { (($#)) && ls "$@" ; }
So you haveThis ensures the expected resultdesired outcome when you do this employing nullglob:
shopt -s nullglob
myls empty_directory/*
Designers have taken the safe option, because many commands take implicit value when no argument is given, often giving a behavior that is not consistent with the semantic of nothing.
When you designdesigning a language default, yourthe priority is to take theadopt an option that would cause lessminimizes unexpected behavior, and you prefer to rise exception than doing unexpected things. Opting for exceptions over unpredictable actions is preferred.
 You can verify this, as soon as you setIt's essential to note that introducing nullglob ininto a richcomplex script with unexpectedunpredictable input variation, itvariations may becomerender it unstable. It is likeIn practice, it could be considered a falseseemingly good idea that, in factreality, unless you spend morerequires additional time makingfor preventive debugdebugging.