diff --git a/NEWS b/NEWS index b6d7f7a8c..7223a2e66 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ Any uppercase BUG_* names are modernish shell bug IDs. <##pattern redirection operators will not work and the -n option to the read built-in will not return early when reading from a slow device.) +- An interactive shell initialized in POSIX mode now once again has the + preset aliases defined. This amends a change made on 2020-09-11. + 2022-06-08: - If -B/--braceexpand is turned on in --posix mode, it now only allows brace diff --git a/src/cmd/ksh93/sh.1 b/src/cmd/ksh93/sh.1 index 7557a9481..361308e49 100644 --- a/src/cmd/ksh93/sh.1 +++ b/src/cmd/ksh93/sh.1 @@ -811,11 +811,7 @@ definition command has to be executed before the command which references the alias is read. .PP The following aliases are automatically preset -when the shell is invoked as an interactive shell, -unless invoked in POSIX compliance mode -(see -.I Invocation\^ -below). +when the shell is invoked as an interactive shell. Preset aliases can be unset or redefined. .RS 20 .PD 0 @@ -7700,9 +7696,8 @@ is automatically turned on upon invocation if the shell is invoked as \fBsh\fR or \fBrsh\fR, or if \fB\-o posix\fR or \fB\-\-posix\fR is specified on the shell invocation command line, or when executing scripts without a \fB#!\fR path with this option active in the invoking shell. In that case, the invoked shell -will not set the preset aliases even if interactive, and will not import type -attributes for variables (such as integer or left/right justify) -from the environment. +will not import type attributes for variables (such as integer or left/right +justify) from the environment. .RS 8 .PP In addition, while on, the \fBposix\fR option diff --git a/src/cmd/ksh93/sh/main.c b/src/cmd/ksh93/sh/main.c index 5d2c20e0b..065f6d85c 100644 --- a/src/cmd/ksh93/sh/main.c +++ b/src/cmd/ksh93/sh/main.c @@ -166,12 +166,9 @@ int sh_main(int ac, char *av[], Shinit_f userinit) { sh_onoption(SH_BGNICE); sh_onoption(SH_RC); - if(!sh_isoption(SH_POSIX)) - { - /* preset aliases for interactive non-POSIX ksh */ - dtclose(sh.alias_tree); - sh.alias_tree = sh_inittree(shtab_aliases); - } + /* preset aliases for interactive ksh/sh */ + dtclose(sh.alias_tree); + sh.alias_tree = sh_inittree(shtab_aliases); } #if SHOPT_REMOTE /*