[arch-general] [PATCH 16/48] Change the daemon running loop to use a case statement.

Victor Lowther victor.lowther at gmail.com
Wed Jun 30 17:47:43 EDT 2010


This is shorter and easier to read.
---
 rc.multi |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/rc.multi b/rc.multi
index 46c18df..ec6fda6 100755
--- a/rc.multi
+++ b/rc.multi
@@ -13,13 +13,11 @@ run_hook multi_start
 
 # Start daemons
 for daemon in "${DAEMONS[@]}"; do
-	if [[ $daemon = ${daemon#!} ]]; then
-		if [[ $daemon = ${daemon#@} ]]; then
-			start_daemon $daemon
-		else
-			start_daemon_bkgd ${daemon:1}
-		fi
-	fi
+    case ${daemon:0:1} in
+        '!') continue;;     # Skip this daemon.
+        '@') start_daemon_bkgd ${daemon#@};;
+        *)   start_daemon $daemon;;
+    esac
 done
 
 if [[ -x /etc/rc.local ]]; then
-- 
1.7.1



More information about the arch-general mailing list