> To wrangle these beasts, we’ve all resorted to wrapping commands in shell scripts or aliases—the infamous “bash spaghetti.” This approach may solve the repeatability problem, but it introduces new ones:
> Argument Wrestling: Ever tried to figure out if a bash variable is a string or an array? Or when to quote something with spaces? It’s a battle.
> Discoverability Disaster: Your beautifully crafted CLI tool is now hidden behind an unsightly bash script. Not the most welcoming first impression.
3 comments
[ 1204 ms ] story [ 1712 ms ] thread> To wrangle these beasts, we’ve all resorted to wrapping commands in shell scripts or aliases—the infamous “bash spaghetti.” This approach may solve the repeatability problem, but it introduces new ones:
> Argument Wrestling: Ever tried to figure out if a bash variable is a string or an array? Or when to quote something with spaces? It’s a battle.
> Discoverability Disaster: Your beautifully crafted CLI tool is now hidden behind an unsightly bash script. Not the most welcoming first impression.
>Or when to quote something with spaces? It’s a battle.
You __ALWAYS__ quote and if you want to be on the safe side you always use "{}" around the variables as well.
You also use "set -o nounset" to do yourself the favor of not working with variables that don't exist because of e.g. typos.
>Discoverability Disaster: Your beautifully crafted CLI tool is now hidden behind an unsightly bash script. Not the most welcoming first impression.
How's that different from the macro? The attempt is the same, to abstract the complex command line options of a tool behind something "easier".