path: root/bash
diff options
authorTom Ryder <tom@sanctum.geek.nz>2017-01-25 14:00:17 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-25 14:06:03 +1300
commit43c88db1a7b402f28567e2659a40943b2a1a54ac (patch)
tree6d15afa0d2afbb96ac6a7cdfd193e6f1bc881cc8 /bash
parentBe more specific in ref name trimming (diff)
Clear away all aliases for interactive shells
Some systems like OpenBSD or Slackware set up well-meaning aliases that I don't want. We do this for Bash, Yash, and Zsh, but not for Ksh, because it looks like its implementations all variously use aliases to implement some POSIX builtins like fc(1) or type(1) in terms of their own builtins.
Diffstat (limited to 'bash')
1 files changed, 5 insertions, 0 deletions
diff --git a/bash/bashrc b/bash/bashrc
index 3070c00c..ca13c4bf 100644
--- a/bash/bashrc
+++ b/bash/bashrc
@@ -9,6 +9,11 @@ esac
# shellcheck disable=SC2128
[ -n "$BASH_VERSINFO" ] && shopt -q restricted_shell && return
+# Clear away all aliases; we do this here rather than in $ENV because the ksh
+# family of shells relies on aliases to implement certain POSIX utilities like
+# fc(1) and type(1)
+unalias -a
# If ENV is set, source it to get all the POSIX-compatible interactive stuff;
# we should be able to do this even if we're running a truly ancient Bash
[ -n "$ENV" ] && . "$ENV"