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?
MacOS – What automatic script runs with Bourne Shell (/bin/sh) for root
bashcommand linemacosscript
Related Question
- Automator – Fix ‘Run Shell Script’ Error Due to Missing ‘on’ Command
- AppleScript – Run Shell Script with User Input
- Terminal Command – Change Command Prompt for Root User in Sierra
- OSX Environment Variables – How to Create Environment Variables Recognized by OSX GUI
- MacOS – Node Program Runs in Terminal, but Not As a “do shell script” AppleScript
- MacOS – lots of errors after sudo bash in terminal
- Bash – Including Virtual Environment in Prompt
Best Answer
This answer comes close to answering the question, but I need to start using
sudo su -
instead ofsudo 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.