This perfectly illustrates the problem with bash.
Somebody did something the straightforward way which worked. A solution is given on a better way, but that also has a problem that somebody else didn't know about.
Bash let's you do anything and have it kind of work but you never know how many footguns you're setting up for yourself.