On 14/03/2023 20:41, Chet Ramey wrote:
On 3/12/23 10:19 PM, Harald van Dijk via austin-group-l at The Open
Group wrote:
bash appears to disables the reading of .profile in POSIX mode entirely.
This isn't quite correct. By default, a login shell named `sh' or `-sh'
reads /etc/profile and ~/.profile. You can compile bash for `strict posix'
conformance, or invoke it with POSIXLY_CORRECT or POSIX_PEDANTIC in the
environment, and it won't.
Isn't it? The mode bash gets into when invoked as sh is described in the
manpage (looking at the 5.2.15 manpage) as:
If bash is invoked with the name sh, it tries to mimic the startup
behavior of historical versions of sh as closely as possible, while
conforming to the POSIX standard as well. [...] When invoked as sh,
bash enters posix mode after the startup files are read.
The mode bash gets into when POSIXLY_CORRECT is set, the mode that can
also be obtained with --posix, is described in the manpage as:
When bash is started in posix mode, as with the --posix command line
option, it follows the POSIX standard for startup files.
My wording appears to be consistent with how bash describes itself in
its manpage: there is POSIX mode during startup file processing, and
POSIX mode after startup file processing. Only the POSIXLY_CORRECT /
--posix behaviour causes startup file processing to happen in POSIX
mode, and results in the reading of .profile being disabled.
But if I am misunderstanding how you intend for the different modes of
bash to be referred to, if you can clarify I can take care to be more
careful with my wording in the future.
Cheers,
Harald van Dijk