[PATCH 18/48] Bashify conditional checking in rc.single.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



---
 rc.single |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/rc.single b/rc.single
index f986a2a..aa58b4c 100755
--- a/rc.single
+++ b/rc.single
@@ -8,10 +8,10 @@
 
 run_hook single_start
 
-if [ "$PREVLEVEL" != "N" ]; then
+if [[ $PREVLEVEL != N ]]; then
 
 	# Find daemons NOT in the DAEMONS array. Shut these down first
-	if [ -d /var/run/daemons ]; then
+	if [[ -d /var/run/daemons ]]; then
 		for daemon in $(/bin/ls -1t /var/run/daemons); do
 		  if ! in_array $daemon ${DAEMONS[@]}; then
 				stop_daemon $daemon
@@ -20,8 +20,8 @@ if [ "$PREVLEVEL" != "N" ]; then
 	fi
 	# Shutdown daemons in reverse order
 	let i=${#DAEMONS[@]}-1
-	while [ $i -ge 0 ]; do
-		if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
+	while ((i >= 0)); do
+		if [[ ${DAEMONS[$i]:0:1} != '!' ]]; then
 			ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
 		fi
 		let i=i-1
@@ -66,17 +66,17 @@ if [ "$PREVLEVEL" != "N" ]; then
 	run_hook single_udevsettled
 
 	# try syslog-NG first, then fall back to good ol' syslogd
-	if [ -x /etc/rc.d/syslog-ng ]; then
+	if [[ -x /etc/rc.d/syslog-ng ]]; then
 		/etc/rc.d/syslog-ng start
-	elif [ -x /etc/rc.d/syslogd ]; then
+	elif [[ -x /etc/rc.d/syslogd ]]; then
 		/etc/rc.d/syslogd start
-		[ -x /etc/rc.d/klogd ] && /etc/rc.d/klogd start
+		[[ -x /etc/rc.d/klogd ]] && /etc/rc.d/klogd start
 	fi
 fi
 
 run_hook single_end
 
-if [ "$RUNLEVEL" = "1" ]; then
+if [[ $RUNLEVEL = 1 ]]; then
 	printsep
 	printhl "Entering single-user mode..."
 	# make sure /dev/initctl is in place
-- 
1.7.1



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux