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>
This commit is contained in:
Kairui Song 2021-08-04 15:18:59 +08:00
parent 6d45257cc1
commit c4d85142be
2 changed files with 3 additions and 3 deletions

View File

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

View File

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