[arch-projects] [PATCH 3/3] rc: exit with a meaningful value

Dave Reisner d at falconindy.com
Sat Apr 23 21:01:19 EDT 2011


---
 rc |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/rc b/rc
index 9abeb52..1e64119 100755
--- a/rc
+++ b/rc
@@ -11,10 +11,12 @@ e.g: rc list
      rc help
      rc start sshd gpm
 EOF
+	exit 1
 }
 
-(( $# < 1 )) && usage && exit 1
+(( $# < 1 )) && usage
 
+declare -i ret=0
 case $1 in
 	help)
 		usage
@@ -43,9 +45,10 @@ case $1 in
 		shift
 		for i; do
 			[[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
+			(( ret += $? ))
 		done
 esac
 
-true
+exit $ret
 
 # vim: set ts=2 sw=2 noet:
-- 
1.7.4.4



More information about the arch-projects mailing list