SVN: rc-scripts/trunk/run-parts

glen glen at pld-linux.org
Tue Oct 28 01:09:42 CET 2008


Author: glen
Date: Tue Oct 28 01:09:41 2008
New Revision: 9926

Modified:
   rc-scripts/trunk/run-parts
Log:
- add --test and -- to behave like debian run-parts(1)

Modified: rc-scripts/trunk/run-parts
==============================================================================
--- rc-scripts/trunk/run-parts	(original)
+++ rc-scripts/trunk/run-parts	Tue Oct 28 01:09:41 2008
@@ -20,15 +20,24 @@
 	shift
 fi
 
+if [ "$1" = "--test" ]; then
+	test=yes
+	shift
+fi
+
+if [ "$1" = "--" ]; then
+	shift
+fi
+
 # std checks
 if [ $# -lt 1 ]; then
-	echo "Usage: run-parts [-u] <dir> <args...>"
+	echo "Usage: run-parts [-u] [--test] <dir> <args...>"
 	exit 1
 fi
 
 if [ ! -d $1 ]; then
 	echo "Is not a directory: $1"
-	echo "Usage: run-parts [-u] <dir> <args...>"
+	echo "Usage: run-parts [-u] [--test] <dir> <args...>"
 	exit 1
 fi
 
@@ -60,6 +69,10 @@
 
 	if [ -x "$i" ]; then
 		runprog="$i $@"
+		if [ "$test" = yes ]; then
+			echo "$runprog"
+			continue
+		fi
 		if [ "$workasuser" = "yes" ]; then
 			runuser="$(/bin/ls -l "$i" | awk ' { print $3 } ' 2> /dev/null)"
 			[ -z "$runuser" ] && echo "Warning: Can't find owner for [$i] file. Not running." && continue


More information about the pld-cvs-commit mailing list