Is there a way to run something like su -l
that reads all the login shell files but doesn't change the directory that you're in?
For some motivation, I'm trying to create a Slackware Linux package. Most of the time packages will build correctly if you just use su
. However, there are some packages like sbcl
that depend on TeX
tools and will fail without su -l
. I prefer using su
when I can get away with it because it doesn't change the current directory.
If I'm in a directory like ~/opt/haskell-stack-slackbuild
.
$ pwd
/home/<user>/opt/haskell-stack-slackbuild
If I just run su
I'm back in the same directory, but if I run su -l
then I get dropped in /root
regardless of where I was and have to navigate back to the directory I was working in.
$ su -l
# pwd
/root