In this post, I describe the improvements I made to kvothe/elm-countries-quiz to integrate it with Nix + pnpm + Parcel + lydell/elm-safe-virtual-dom.
Great post - this feels super relevant to me, as just this morning I added a bunch of shellHook stuff to the nix develop shell in my current project. On that topic, why is it the case that “for almost every purpose, shell functions are preferable to aliases”? I’ve been using aliases, but maybe I should switch!
Thanks!
why is it the case that “for almost every purpose, shell functions are preferable to aliases”?
First off the Bash manual on aliases says so at the very end. So there’s that. But to be more concrete here are a few reasons why:
- Aliases are dumb text replacement
- Functions handle arguments properly
- Functions have scope and variables
- Functions support control flow
- Functions can compose and call other functions
- Functions can be debugged
- Functions work in scripts and non-interactive shells in a consistent way
Aliases are fine when you need short, mnemonic abbreviations to one-liners with zero arguments at an interactive prompt. If you ever think “I wish this alias could…” then it should be a function instead.
Thanks so much for your contribution! ![]()