POSIX way to check if command is shell function
is_function() {
test "$(command -v "$1")" = "$1"
}
is_function cd && echo 'Yes it is'
Written by Adam Stankiewicz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#