710f643313bcdfefe436d463815e531b94191e92
[platform/upstream/bash.git] / examples / functions / func
1 #
2 # func -- print out definitions for functions named by arguments
3 #
4 # usage: func name [name ...]
5 #
6 # Chet Ramey
7 # chet@ins.CWRU.Edu
8 func()
9 {
10         local status=0
11
12         if [ $# -eq 0 ] ; then
13                 echo "usage: func name [name...]" 1>&2
14                 return 1
15         fi
16
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
27 }