I want to add some aliases to my OSX command line environment for easier navigation when in the root prompt (sudo su
to root). On the Bourne Again Shell (/bin/bash), I can edit /var/root/.bash_profile. But with the Bourne Shell (/bin/sh), what script do I edit for that?
1 Answer
This answer comes close to answering the question, but I need to start using sudo su -
instead of sudo su
in order to switch from regular user to root or the /var/root/.profile
script won't execute.
Now, unless Apple changes this, regular users by default will get the Bash shell, instead of the Bourne shell, which is unlike the root user. So, for those users, simply editing ~/.bash_profile
will work fine.
-
1I'd like to point out that
/bin/sh
is not the Bourne shell on OS X or any other modern Unix or Unix-like OS./bin/sh
is a POSIX compliant shell which the Bourne shell is not. If the aliases exist in your current environment then just usesudo -s
instead of creating a.profile
in root's home folder..– fd0May 30, 2016 at 18:31
.sh_profile
? I don't know whether it'll help but maybe it will. Just a random guess.sudo -s
be an option (which would start a root shell with the current value of$SHELL
)?