Bash word splitting

The problem The code examples below make my eyes bleed, and if you don’t see it, read on – or stop writing Bash. for f in $(ls *.mp3); do rm -rf "$f" done for f in $(find -name '*.mp3'); do rm -rf $f done We will go over what’s wrong with such code, but before, we need to understand Bash a little better. How bash executes commands The argument vector and execve At its core, Bash is simply a command executor....

February 7, 2023 · 5 min · Lucas Viana