On 11/17/23 12:41, Garrett Wollman wrote:
<<On Fri, 17 Nov 2023 13:40:44 -0500, mike tancsa <m...@sentex.net> said:
I am trying to bring my environment along from previous versions where
csh was the default shell and now trying to get used to sh. In the past
things like
sudo su
would pick up my settings in /root/.cshrc automatically. However, with
sh I have to do
sudo su -l root
Is there a way to configure it so I dont need the -l as part of the su
to get the same behavior ?
See sh(1) section "Invocation", which describes how /bin/sh reads its
initialization files, and in particular, that (as POSIX specifies)
interactive non-login shells do not read any startup files unless the
environment variable `ENV` is set. This is stupid but required by the
standard.
I would recommend changing root's shell to something that better suits
your needs: either change it back to csh, or install the appropriate
package and set it to bash or zsh, both of which read startup files
for all interactive shells, not just login shells.
Though it was worse when upgrading using portupgrade and less likely to
be an issue with packages, I would still consider trying to keep root's
shell as a shell that is part of base and if I really wanted a different
one then I would have a 3rd party shell get launched from a shell from
base as part of the sign in process so it could 'fall back' to skipping
the launch if it fails. This comes from having had issues with 3rd party
shells not functioning for reasons such as it depending on a library
that failed to install properly. I do not have my desktop boot into X
automatically or use a graphical login manager for the same reason;
problems are easier to fix when you can still log in successfully. I
have not often had such issues, but I certainly have had them.
-GAWollman