Skip to content

Instantly share code, notes, and snippets.

@mredar
Created July 5, 2017 21:51
Show Gist options
  • Save mredar/8fd4504a6558ed638e439f325022c6cd to your computer and use it in GitHub Desktop.
Save mredar/8fd4504a6558ed638e439f325022c6cd to your computer and use it in GitHub Desktop.
show command bash - will check aliases, functions and commands
function show
{
# Show the definition of the verb given in $1 e.g. `show ll` (alias) or
# `show show` (function) or `show who` (command).
verb=$1
alias $1 2>/dev/null \
|| declare -f $1 2>/dev/null \
|| /usr/bin/which $1 2>/dev/null \
|| echo "Unrecognized command '$1'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment