4 ms·
I think the real point is that most of the time when someone writes a bashism, it's unnecessary. You don't really lose anything 99% of the time by writing posix
by ever1337 4y ago
I think the real point is that most of the time when someone writes a bashism, it's unnecessary. You don't really lose anything 99% of the time by writing posix shell. If you need bash, write bash, and just change the shebang.
- bccdee 4y agoI think real arrays are the exception to this rule. They're the only non-posix shell feature I use consistently. Otherwise, whenever you want to gather a list of strings or filenames and then iterate through them, you need to worry about delimiters and splitting and parsing and IFS and that's simply not worth the dubious benefit of not including a bash shebang. If you really need to run the script on alpine, just install bash. If you're really space-constrained, then sure, go back and refactor the arrays into newline-delimited strings or whatever, but I've never had to do that and I doubt I ever will. Getting to use arrays means my scripts can avoid dealing with the horrible quirks of shell tokenization, and that's 100% worth it to me.
- jjgreen 4y agoThe number of times I have seen this: #!/usr/bin/bash some-other-program -c -x $1