bash scripts: get rid of expr and let

upstream: fedora
resolves: bz2003832
conflict: none

commit c4d85142be300814b8818fe8aad65eaa042e01c8
Author: Kairui Song <kasong@redhat.com>
Date:   Wed Aug 4 15:18:59 2021 +0800

    bash scripts: get rid of expr and let

    As suggested by:
    https://github.com/koalaman/shellcheck/wiki/SC2219

    Signed-off-by: Kairui Song <kasong@redhat.com>
    Acked-by: Philipp Rudo <prudo@redhat.com>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2021-11-03 16:19:07 +08:00
parent e07098aa14
commit 480de7c63d
2 changed files with 3 additions and 3 deletions

View File

@ -196,7 +196,7 @@ cal_netmask_by_prefix() {
_res="$_first_part"
_tmp=$((_octets_total*_bits_per_octet-_prefix))
_zero_bits=$(expr $_tmp % $_bits_per_group)
_zero_bits=$((_tmp % _bits_per_group))
if [[ "$_zero_bits" -ne 0 ]]; then
_second_part=$((_max_group_value >> _zero_bits << _zero_bits))
if ((_ipv6)); then

View File

@ -741,7 +741,7 @@ check_and_wait_network_ready()
fi
cur=$(date +%s)
let "diff = $cur - $start_time"
diff=$((cur - start_time))
# 60s time out
if [ $diff -gt 180 ]; then
break;
@ -804,7 +804,7 @@ show_reserved_mem()
local mem_mb
mem=$(</sys/kernel/kexec_crash_size)
mem_mb=$(expr "$mem" / 1024 / 1024)
mem_mb=$((mem / 1024 / 1024))
dinfo "Reserved "$mem_mb"MB memory for crash kernel"
}