diff options
author | Jakub Jankowski <shasta@toxcorp.com> | 2017-11-21 02:11:55 +0100 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2017-11-21 00:07:59 -0600 |
commit | fffe03a02f8d61480cace91dd0612de7ea6be2ca (patch) | |
tree | d0f779c507b39887984655decfd015d475a0e734 | |
parent | f6cfb92d54918c46dbc8673396333b50317cfb36 (diff) | |
download | slacknetsetup-fffe03a02f8d61480cace91dd0612de7ea6be2ca.tar.xz |
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 <rworkman@slackware.com>
-rw-r--r-- | rc.inet1 | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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} ; |