Op 24-08-20 om 19:30 schreef Vincent Lefevre:
However, "command cd" is not guaranteed to work in a POSIX shell, e.g. if $PATH has changed.
That's actually not true, 'cd' is intrinsically a built-in utility (it couldn't possibly function otherwise, as it must affect the current environment) and it is also explicitly exempt from a $PATH search by XCU 2.9.1.4(d)[*] (not that most shells follow that absurd $PATH search rule for builtins anyway, but that's a different rant). Point being, POSIXly, 'command cd' is safe.
- Martijn[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
-- || modernish -- harness the shell || https://github.com/modernish/modernish || || KornShell lives! || https://github.com/ksh93/ksh