From fffe03a02f8d61480cace91dd0612de7ea6be2ca Mon Sep 17 00:00:00 2001 From: Jakub Jankowski Date: Tue, 21 Nov 2017 02:11:55 +0100 Subject: rc.inet1: Replace [ test1 -a test2 ] with [ test1 ] && [ test2 ] Conditional expression like [ test1 -a test2 ] should be avoided as it is not well defined. See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16 and https://github.com/koalaman/shellcheck/wiki/SC2166 Signed-off-by: Robby Workman --- rc.inet1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index b3f3596..fbd9d59 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -16,7 +16,7 @@ ########### # If possible, log events in /var/log/messages: -if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then +if [ -f /var/run/syslogd.pid ] && [ -x /usr/bin/logger ]; then LOGGER=/usr/bin/logger else # output to stdout/stderr: LOGGER=/bin/cat @@ -138,7 +138,7 @@ if_up() { [ -n "${BRNICS[$i]}" ] && br_open $i # If the interface isn't in the kernel yet (but there's an alias for it in # modules.conf), then it should be loaded first: - if [ "${IPADDR[$i]}" = "" -a "${USE_DHCP[$i]}" != "yes" ]; then # skip unconfigured interfaces + if [ "${IPADDR[$i]}" = "" ] && [ "${USE_DHCP[$i]}" != "yes" ]; then # skip unconfigured interfaces if [ "$DEBUG_ETH_UP" = "yes" ]; then echo "/etc/rc.d/rc.inet1: skipping ${1} early, interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER fi @@ -201,7 +201,7 @@ if_up() { echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1}" | $LOGGER /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS} ${1} # If the dhcpcd call succeeds, add extra IP addresses, if defined, to interface - if [ "$?" == "0" -a ! -z "${IPALIASES[$1]}" ]; then + if [ "$?" == "0" ] && [ ! -z "${IPALIASES[$1]}" ]; then num=0 for ipalias in $(echo ${IPALIASES[$i]}); do /sbin/ip address add ${ipalias}/32 dev ${1} label ${1}:${num} ; -- cgit v1.2.3