Hacker News new | ask | show | jobs
by jwilk 3030 days ago
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/a...

One of the most famous shell-portability issues is related to "$@". When there are no positional arguments, Posix says that "$@" is supposed to be equivalent to nothing, but the original Unix version 7 Bourne shell treated it as equivalent to "" instead, and this behavior survives in later implementations like Digital Unix 5.0.

The traditional way to work around this portability problem is to use ${1+"$@"}.

1 comments

Thanks for digging that up! But for scripts written for FreeBSD in 2002 [1], I have to wonder which non-POSIX-y shells they were worried about.

[1]: https://github.com/freebsd/freebsd/commit/55d0b8395514ae4055...