src/utils/userApps/mkREADME.sh 1.2

1.2 2009/04/06 17:54:40 hiram
Make it work from parameters
Index: src/utils/userApps/mkREADME.sh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/userApps/mkREADME.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/utils/userApps/mkREADME.sh	30 Mar 2009 17:55:21 -0000	1.1
+++ src/utils/userApps/mkREADME.sh	6 Apr 2009 17:54:40 -0000	1.2
@@ -1,26 +1,51 @@
 #!/bin/sh
+# script to create a FOOTER (or README) file from all usage messages
+#	of binaries found in specified directory
+#
+#========================================================================
+#	$Id$
+#========================================================================
+#
+usage() {
+    echo "usage: mkREADME.sh DESTDIR/BINDIR FOOTER"
+    echo "where DESTDIR/BINDIR is where all the binaries are"
+    echo "and FOOTER is the name of the result file"
+    exit 255
+}
+
+if [ "$#" -ne 2 ]; then
+    usage
+fi
+
+DESTDIR=$1
+RESULT=$2
+
+if [ ! -d "${DESTDIR}" ]; then
+    echo "ERROR: specified destination directory \"${DESTDIR}\""
+    echo "	does not exist."
+    usage
+fi
+
+cd "${DESTDIR}"
 
 echo "================================================================
 See also: the file in this directory: bigBedWigs.txt
 	for information on operating the bigWig and bigBed
 	utilities and loading custom tracks
 ================================================================
-" > README.txt
+" > "${RESULT}"
 
 echo "================================================================" \
-	>> README.txt
+	>> "${RESULT}"
 
 find . -mindepth 1 -type f | sed -e "s/^.\///; /mkREADME.sh/d" | sort | \
 while read F
 do
     if [ -x "${F}" ]; then
 	echo "========   ${F}   ===================================="
 	echo "================================================================"
 	./${F}
 	echo "================================================================"
 	fi
-done >> README.txt 2>&1
+done >> "${RESULT}" 2>&1
 
-#========================================================================
-#	$Id$
-#========================================================================