>>>>> On Thu, 23 Feb 2012 19:51:27 -0800, Bryan Richter
>>>>> <[email protected]> said:
BR> Functions can be discovered with 'declare -f'.
The problem with todays environment is that there is real-executables,
aliases and functions. Aliases are pretty much lame in bash so everyone
uses functions (which can take arguments, etc).
But in the end, there are in fact 3 places to look for a definition. So
about a month ago I wrote this:
wh() {
prog="$1"
if [ "`declare -F $prog`" != "" ] ; then
declare -f $prog
elif alias $prog > /dev/null 2>&1 ; then
alias $prog
else
which $prog
fi
}
Which if you use in replace of `which` checks all three sources and
reports the definition or location to you.
# wh ifconfig
/sbin/ifconfig
# wh wh
wh ()
{
prog="$1"
...
--
Wes Hardaker
My Pictures: http://capturedonearth.com/
My Thoughts: http://pontifications.hardakers.net/
_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech