It dawned on me (after untold years of set -o vi on boxes belonging to other people), that sudo must have some variable to indicate who the invoking user is; it does. The variable is called $SUDO_USER.

Starting right now, Ansible is dropping this template into /etc/profile.d/ on a lot of machines.

if [ "${SUDO_USER}" = "jpm" ]; then
  set -o vi
  alias l='ls -l'
  alias r='fc -e -'

That marks the end of sudo su - for me. From now on, it shall be sudo -i.

Life can be good.


blog comments powered by Disqus