"Will I ever have to read and modify this script again? Effectively-100% likely. Will this script ever run anywhere that I don't have the GNU toolchain? Effectively-0% likely."
It's a no-brainer at that point.
If you can't say that second part honestly, reconsider, but a lot of us can.
Not really. A lot of stuff broke when /bin/sh moved to a POSIX-compatibile shell rather than Bash.
#!/bin/bash wilya@home $ /bin/bash
zsh: no such file or directory: /bin/bash
wilya@home $ which bash
/usr/local/bin/bash
(Yes, I'm annoyed when I see #!/bin/bash, especially on scripts which are otherwise basic enough to be portable everywhere) #!/usr/bin/env bash
Assuming env is installed (I believe I had to install a package on OpenBSD to use it) this will find the first instance of bash in the PATH.I really am not worried about that in my world. The dependencies on Linux go a great deal deeper than the GNU toolchain. YMMV.
That's not the case for most people though. I can't even remember the last time I saw even a tiny project assume the world is all "whatever gnu/linux distro I happen to use". Tons of people use linux distros that aren't ubuntu, tons of people use OSX, tons of people use a BSD.
My ultimate rule: write the code that is the most readable, because in 10, 15, 30 years, someone can easily update a script to working arguments from arguments with long words, whereas single letter arguments may have multiple different meanings on different systems. It's the same with naming conventions and code constructs: the how and the what should be obvious from the code.
What current systems have arguments that conflict with those?
Thank you for that. I was aware of the POSIX docs for C/system level programming, but I wasn't sure if command arguments were standardized.
What current systems have arguments that conflict with those?
Ah, but "current" is not always what we get. It's been a while, but I can vaguely remember conflicting single character arguments for basic commands (eg, ls, ps) on OSF/1, SunOS and Linux.
For something you're planning to deploy to customers, it probably makes sense to play it pretty strict with POSIX.
Likewise, I usually script straight sh for portability if it's going to a customer unless there's a compelling reason to use bash. I'll mix in bash in stuff I write for myself where it makes my life simpler.