From: Mark Wooding Date: Sat, 4 Jun 2011 13:15:22 +0000 (+0100) Subject: dot/bashrc: Fix `rootly' to make a shell on demand. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/ac03a1f6de3456e4f41330a3bf4644fa76bc1193?hp=-c dot/bashrc: Fix `rootly' to make a shell on demand. Annoyingly, `sudo' doesn't start a shell if you don't give it a command to run. So turn `rootly' into a shell function which does the right thing for me. --- ac03a1f6de3456e4f41330a3bf4644fa76bc1193 diff --git a/dot/bashrc b/dot/bashrc index c39392a..69af4a1 100644 --- a/dot/bashrc +++ b/dot/bashrc @@ -98,7 +98,10 @@ alias cx='chmod a+x' alias which="command -v" alias rc="rc -l" alias ssync="rsync -e ssh" -alias rootly=$__MDW_ROOTLY +rootly () { + case $# in 0) set -- "${SHELL-/bin/sh}" ;; esac + $__MDW_ROOTLY "$@" +} alias r=rootly alias re="rootly $EDITOR" alias pstree="pstree -hl"