Re:Use long flags when scripting (2013)
by kazinator on Friday September 18, 2020 @02:14PM
(#24520057)
You don't know that your script will run fine anywhere, if you've not actually run it there.
But, still, that's no reason to adopt a mindset of actively wrecking the chances of such success.
(Which is what passive ignorance amounts to, effectively).
Though sometimes you don't need to go that far to break stuff, for instance switching from Fedora to Ubuntu. I've seen many scripts fail on debian derivatives because people think using #!/bin/sh as a shebang is fine since it works on their computer where sh was in fact a symlink to bash.
But on debian based distributions /bin/sh is often dash, not bash, and dash is basically the strict POSIX subset + local, all fancy stuff like [[ ]], &>, arrays, ... will fail.
Though this is less about long options here and more about general shell scripting.