3 ms·
Also some shells will refuse to run a builtin if there is no executable in the path that matches it. POSIX actually mandates this behavior for any builtin not
by aidenn0 9y ago
Also some shells will refuse to run a builtin if there is no executable in the path that matches it.
POSIX actually mandates this behavior for any builtin not on a specific list, though most shells (even dash, which is typically obsessive about complying with POSIX) do not implement this behavior.
- LukeShu 9y agoThat didn't sound right to me, but I looked it up, and you're right. The scripts we're discussing were written in 2002 [1], so the time-appropriate version is POSIX-2001 (Issue 6). [1]: https://github.com/freebsd/freebsd/commit/55d0b8395514ae4055e7af8e4e9812637dbcc463 https://github.com/freebsd/freebsd/commit/55d0b8395514ae4055... But you don't have to take my word for it: I've paste-bin'ed the entirety of what POSIX-2001 had to say about shell built-ins (in general, I didn't include man-pages for individual built-ins): https://lukeshu.com/dump/posix-2001-builtins.txt https://lukeshu.com/dump/posix-2001-builtins.txt As for whether that's still true today, looking at POSIX-2008 (Issue 7), 2013 edition (I don't have a copy of the 2016 edition handy), none of that has changed.
- aidenn0 9y agoI only discovered this because I implemented a shell specifically by the specification (just for didactic purposes). I was unable to find a modern shell that acted this way, even with passing the "be more POSIXy" options though.