I think we're due for an 'advanced bash' talk ;) Stuff like this, as well as adding your own programs' completion functions (e.g. trying 'tuxpaint --f<tab><tab>' yields "--fancycursors --fullscreen", and 'mplayer <tab><tab>' to shows playable media in the current directory)
-bill! On Fri, Feb 24, 2012 at 07:55:32AM -0800, Wes Hardaker wrote: > >>>>> 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 -- -bill! Sent from my computer _______________________________________________ vox-tech mailing list [email protected] http://lists.lugod.org/mailman/listinfo/vox-tech
