Patch-ID: bash40-021
[bash.git] / examples / functions / func
blob710f643313bcdfefe436d463815e531b94191e92
2 # func -- print out definitions for functions named by arguments
4 # usage: func name [name ...]
6 # Chet Ramey
7 # chet@ins.CWRU.Edu
8 func()
10         local status=0
12         if [ $# -eq 0 ] ; then
13                 echo "usage: func name [name...]" 1>&2
14                 return 1
15         fi
17         for f
18         do
19                 if [ "$(builtin type -type $f)" != "function" ] ; then
20                         echo "func: $f: not a function" 1>&2
21                         status=1        # one failed
22                         continue
23                 fi
24                 builtin type $f | sed 1d
25         done
26         return $status