Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!drutx!mtuxo!mtune!mtunf!mtung!mtunh!akguc!akgua!emory!arnold From: arnold@emory.UUCP (Arnold D. Robbins {EUCC}) Newsgroups: net.unix-wizards,net.sources Subject: V8 'whatis' for ksh Message-ID: <1612@emory.UUCP> Date: Fri, 2-May-86 13:49:29 EDT Article-I.D.: emory.1612 Posted: Fri May 2 13:49:29 1986 Date-Received: Wed, 7-May-86 06:17:54 EDT Distribution: net Organization: Math & Computer Science, Emory University, Atlanta Lines: 58 Xref: watmath net.unix-wizards:17969 net.sources:4900 Here is a function that pretty much implements the V8 shell 'whatis' builtin command. This command, for each argument, prints out what it is in relation to the shell. For each argument, it prints it out in the same way one would type it as input to the shell, for instance, functions as their definitions and parameters as assignment to their values. It is just something I felt like trying to do as a ksh function, more for fun than anything else. Enjoy. ------- cut here and put in your $ENV file, not a shar file ---------- # whatis --- ksh function to implement the V8 whatis builtin # quote the ksh builtins to defeat aliasing function whatis { 'typeset' i_ foo_ # local variables 'typeset' -i var for i_ in $* do var=0 if 'set' | grep "^${i_}=" > /dev/null then 'set' | grep "^${i_}=" var=1 fi foo_="`'whence' -v ${i_}`" case "$foo_" in *built-in*) 'print' - builtin ${i_} ;; *function*) 'typeset' -f ${i_} ;; *exported*) 'print' - "alias -x '${i_}=${foo_##*alias for }" ;; *tracked*) 'print' - "alias -t '${i_}=${foo_##*alias for }'" ;; *alias*) 'print' - "alias '${i_}=${foo_##*alias for }'" ;; *not\ found) if ((! var)) then 'print' - "$foo_" fi ;; *) 'print' - "${foo_##*is }" ;; esac done return 0 } -- Arnold Robbins CSNET: arnold@emory BITNET: arnold@emoryu1 ARPA: arnold%emory.csnet@csnet-relay.arpa UUCP: { akgua, decvax, gatech, sb1, sb6, sunatl }!emory!arnold "All this digital stuff is just a fad. Analog is the way to go." -- William M. Robbins, 1984