Have written the following function and would like to be able to print a
description
similar to the docstring in elisp.
Perhaps I can call the function this way `headrc h`
headrc ()
 {
   # Prints first set of lines from named files.
   # $1 NUM Number of lines to print
   # $2 DIR Directory
   num=$1
   dir=$2
    Â
   find "$dir" \( -name \*.org -o -name \*.texi \) \
     | xargs head -n "$num";
 }
This is how I do it:
days_in_month() #@ Return number of days in given month
{ #@ USAGE: days_in_month MONTHNUM [year]
[ "$1" = -- ] && shift
case ${1#0} in
9|4|6|11) days_in_month=30 ;; ## 30 days hath September...
1|3|5|7|8|10|12) days_in_month=31 ;;
2) is_leap_year "$2" &&
days_in_month=29 ||
days_in_month=28
;;
*) return 5 ;;
esac
}
grep -A1 '()' file-of-functions
--
Chris F.A. Johnson <http://cfajohnson.com/>
=========================== Author: ===============================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux shell (2009, Apress)