3 ms·
In the far past, it used to be necessary to use ${1+"$@"} because of some shells that didn't handle "$@" properly when it was empty.
by gpvos 7y ago
In the far past, it used to be necessary to use ${1+"$@"} because of some shells that didn't handle "$@" properly when it was empty.
- _kst_ 7y agoI've run into that. There was a problem with the OSF/1 /bin/sh that caused "$@" to expand to a single empty argument if there are no arguments, rather than to an empty list as it should. I just now removed a workaround for that problem from one of my scripts, 17 years after I added it. https://en.wikipedia.org/wiki/OSF/1 https://en.wikipedia.org/wiki/OSF/1
- downerending 7y agoAfter being challenged on this a few years ago, I checked with the shells available on Debian, and at least one still needed this. (dash maybe?) Just do it.