Comment by dspillett
9 hours ago
I was going to say “it always seems to work for me” then I saw “… actually works in Bash and Zsh, because …”.
Another Bash-ism I need to be careful not to use when trying to be portable.
It is worth noting that on a lot of systems /bin/sh isn't bash (or zsh) so if you want to rely on Bashisms (or just can't be bothered looking for them) be specific and use “#!/bin/bash” for you hashbang. On Debian and similar it is usually dash for instance.
For various embedded environments that use busybox it's busybox's brand of ash. I generally enjoy the opportunity to learn when bumping up against these kind of edge cases.
Aye. Even though I'm more than happy to rely on bashisms in my normal work/play, I like to know where the edges are. Even if I don't know off the top of my head what the POSIX way is for something I usually use the bash sugar for, when I need it I know I need it and how to find it.