Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Created January 10, 2017 04:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ormaaj/245417388175ad07fff5c7bdff0dea7a to your computer and use it in GitHub Desktop.
Save ormaaj/245417388175ad07fff5c7bdff0dea7a to your computer and use it in GitHub Desktop.
unset -v aliasRestore
if ${BASH_VERSION+\:} false; then
shopt -s extglob lastpipe
if shopt -q expand_aliases; then
shopt -u expand_aliases
aliasRestore='shopt -s expand_aliases; unset -v aliasRestore'
fi
else
aliasRestore="$(alias) ; unset -v aliasRestore"
unalias -a
fi
... function defs
${aliasRestore:+\:} eval "$aliasRestore" # crap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment