On 3/14/23 4:58 PM, Harald van Dijk wrote:
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.
Right. When you force posix mode immediately, as I said above, bash won't
read the startup files. A login shell named sh or -sh reads the historical
startup fles, then enters posix mode.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/