From 1096cd2ebc150e5c74b5e8e4016b835f34cd3f48 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 29 Jul 2009 17:26:33 -0400 Subject: Use $() instead of `` for process expansion. Adapted from . --- rc.d/init.d/functions | 2 +- rc.d/init.d/halt | 2 +- rc.d/init.d/netconsole | 2 +- rc.d/init.d/netfs | 16 ++++++++-------- rc.d/init.d/network | 12 ++++++------ rc.d/rc | 2 +- rc.d/rc.sysinit | 20 ++++++++++---------- 7 files changed, 28 insertions(+), 28 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 9825019a..82590a16 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -16,7 +16,7 @@ export PATH # Get a sane screen width [ -z "${COLUMNS:-}" ] && COLUMNS=80 -[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="`/sbin/consoletype`" +[ -z "${CONSOLETYPE:-}" ] && CONSOLETYPE="$(/sbin/consoletype)" if [ -f /etc/sysconfig/i18n -a -z "${NOLOCALE:-}" -a -z "${LANGSH_SOURCED:-}" ] ; then . /etc/profile.d/lang.sh 2>/dev/null diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index aba3d3ea..97accb9e 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -93,7 +93,7 @@ tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; } [ -n "$tmpfs" ] && fstab-decode $UMOUNT $tmpfs 2>/dev/null # Turn off swap, then unmount file systems. -[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps` +[ -f /proc/swaps ] && SWAPS=$(awk '! /^Filename/ { print $1 }' /proc/swaps) if [ -n "$SWAPS" ]; then action $"Turning off swap: " swapoff $SWAPS for dst in $SWAPS; do diff --git a/rc.d/init.d/netconsole b/rc.d/init.d/netconsole index 5f6c3020..172a82b9 100644 --- a/rc.d/init.d/netconsole +++ b/rc.d/init.d/netconsole @@ -29,7 +29,7 @@ SYSLOGADDR= SYSLOGPORT=514 SYSLOGMACADDR= -kernel=`uname -r | cut -d. -f1-2` +kernel=$(uname -r | cut -d. -f1-2) usage () { diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs index b0fbed59..302f2e61 100755 --- a/rc.d/init.d/netfs +++ b/rc.d/init.d/netfs @@ -19,15 +19,15 @@ . /etc/init.d/functions . /etc/sysconfig/network -NFSFSTAB=`LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $3 != "nfsd" && $4 !~ /noauto/ { print $2 }' /etc/fstab` -CIFSFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "cifs" && $4 !~ /noauto/ { print $2 }' /etc/fstab` -NCPFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "ncpfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab` -NETDEVFSTAB=`LC_ALL=C awk '!/^#/ && $4 ~/_netdev/ && $4 !~ /noauto/ { print $1 }' /etc/fstab` +NFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $3 != "nfsd" && $4 !~ /noauto/ { print $2 }' /etc/fstab) +CIFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "cifs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) +NCPFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "ncpfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) +NETDEVFSTAB=$(LC_ALL=C awk '!/^#/ && $4 ~/_netdev/ && $4 !~ /noauto/ { print $1 }' /etc/fstab) -NFSMTAB=`LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $2 }' /proc/mounts` -CIFSMTAB=`LC_ALL=C awk '$3 == "cifs" { print $2 }' /proc/mounts` -NCPMTAB=`LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts` -NETDEVMTAB=`LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab` +NFSMTAB=$(LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $2 }' /proc/mounts) +CIFSMTAB=$(LC_ALL=C awk '$3 == "cifs" { print $2 }' /proc/mounts) +NCPMTAB=$(LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts) +NETDEVMTAB=$(LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab) # See how we were called. case "$1" in diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 7695da46..d38622c6 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -39,7 +39,7 @@ fi # Even if VLAN is configured, without the utility we can't do much [ ! -x /sbin/vconfig ] && VLAN= -CWD=`pwd` +CWD=$(pwd) cd /etc/sysconfig/network-scripts . ./network-functions @@ -188,9 +188,9 @@ case "$1" in # If this is a final shutdown/halt, check for network FS, # and unmount them even if the user didn't turn on netfs if [ "$RUNLEVEL" = "6" -o "$RUNLEVEL" = "0" -o "$RUNLEVEL" = "1" ]; then - NFSMTAB=`LC_ALL=C awk '$3 ~ /^nfs/ { print $2 }' /proc/mounts` - SMBMTAB=`LC_ALL=C awk '$3 == "smbfs" { print $2 }' /proc/mounts` - NCPMTAB=`LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts` + NFSMTAB=$(LC_ALL=C awk '$3 ~ /^nfs/ { print $2 }' /proc/mounts) + SMBMTAB=$(LC_ALL=C awk '$3 == "smbfs" { print $2 }' /proc/mounts) + NCPMTAB=$(LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts) if [ -n "$NFSMTAB" -o -n "$SMBMTAB" -o -n "$NCPMTAB" ] ; then /etc/init.d/netfs stop fi @@ -263,12 +263,12 @@ case "$1" in if [ -d /proc/sys/net/ipv4 ]; then if [ -f /proc/sys/net/ipv4/ip_forward ]; then - if [ `cat /proc/sys/net/ipv4/ip_forward` != 0 ]; then + if [ $(cat /proc/sys/net/ipv4/ip_forward) != 0 ]; then action $"Disabling IPv4 packet forwarding: " sysctl -w net.ipv4.ip_forward=0 fi fi if [ -f /proc/sys/net/ipv4/ip_always_defrag ]; then - if [ `cat /proc/sys/net/ipv4/ip_always_defrag` != 0 ]; then + if [ $(cat /proc/sys/net/ipv4/ip_always_defrag) != 0 ]; then action $"Disabling IPv4 automatic defragmentation: " sysctl -w net.ipv4.ip_always_defrag=0 fi fi diff --git a/rc.d/rc b/rc.d/rc index aaa45e66..d918b7c7 100755 --- a/rc.d/rc +++ b/rc.d/rc @@ -20,7 +20,7 @@ check_runlevel () # Now find out what the current and what the previous runlevel are. argv1="$1" -set `/sbin/runlevel` +set $(/sbin/runlevel) runlevel=$2 previous=$1 export runlevel previous diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit index 378129dd..1f40657c 100755 --- a/rc.d/rc.sysinit +++ b/rc.d/rc.sysinit @@ -5,7 +5,7 @@ # Taken in part from Miquel van Smoorenburg's bcheckrc. # -HOSTNAME=`/bin/hostname` +HOSTNAME=$(/bin/hostname) set -m @@ -32,11 +32,11 @@ PLYMOUTH= [ -x /usr/bin/plymouth ] && PLYMOUTH=yes # Check SELinux status -selinuxfs="$(fstab_decode_str `LC_ALL=C awk '/ selinuxfs / { print $2 }' /proc/mounts`)" +selinuxfs="$(fstab_decode_str $(LC_ALL=C awk '/ selinuxfs / { print $2 }' /proc/mounts))" SELINUX_STATE= -if [ -n "$selinuxfs" ] && [ "`cat /proc/self/attr/current`" != "kernel" ]; then +if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then if [ -r "$selinuxfs/enforce" ] ; then - SELINUX_STATE=`cat "$selinuxfs/enforce"` + SELINUX_STATE=$(cat "$selinuxfs/enforce") else # assume enforcing if you can't read it SELINUX_STATE=1 @@ -57,7 +57,7 @@ disable_selinux() { relabel_selinux() { # if /sbin/init is not labeled correctly this process is running in the # wrong context, so a reboot will be required after relabel - REBOOTFLAG=`restorecon -v /sbin/init` + REBOOTFLAG=$(restorecon -v /sbin/init) AUTORELABEL= . /etc/selinux/config if [ "$AUTORELABEL" = "0" ]; then @@ -263,16 +263,16 @@ if [[ "$redhat_release" =~ "Red Hat" ]]; then [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m" echo -en "Red Hat" [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" - PRODUCT=`sed "s/Red Hat \(.*\) release.*/\1/" /etc/redhat-release` + PRODUCT=$(sed "s/Red Hat \(.*\) release.*/\1/" /etc/redhat-release) echo " $PRODUCT" elif [[ "$redhat_release" =~ "Fedora" ]]; then [ "$BOOTUP" = "color" ] && echo -en "\\033[0;34m" echo -en "Fedora" [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" - PRODUCT=`sed "s/Fedora \(.*\) \?release.*/\1/" /etc/redhat-release` + PRODUCT=$(sed "s/Fedora \(.*\) \?release.*/\1/" /etc/redhat-release) echo " $PRODUCT" else - PRODUCT=`sed "s/ release.*//g" /etc/redhat-release` + PRODUCT=$(sed "s/ release.*//g" /etc/redhat-release) echo "$PRODUCT" fi if [ "$PROMPT" != "no" ]; then @@ -384,7 +384,7 @@ if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then fi if [ -f /fsckoptions ]; then - fsckoptions=`cat /fsckoptions` + fsckoptions=$(cat /fsckoptions) fi if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then @@ -616,7 +616,7 @@ fi remount_needed() { local state oldifs [ "$READONLY" = "yes" ] && return 1 - state=`LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts` + state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts) oldifs=$IFS IFS="," for opt in $state ; do -- cgit v1.2.1