From 44e452fb3c8cc7a093d72fbc280be3973e627a62 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Fri, 19 Apr 2019 21:26:04 -0400 Subject: Add braces to param exps in arith substs --- (limited to 'src') diff --git a/src/block.sh b/src/block.sh index f3fb8da..bb46e25 100644 --- a/src/block.sh +++ b/src/block.sh @@ -73,7 +73,7 @@ block_umount() i=0 timed_out=false while ! umount "${dir}"; do - i=$(($i + 1)) + i=$((${i} + 1)) if [ ${i} -eq 10 ]; then timed_out=true break diff --git a/src/cmd/install.sh b/src/cmd/install.sh index 638cbd1..a6c208a 100644 --- a/src/cmd/install.sh +++ b/src/cmd/install.sh @@ -32,7 +32,7 @@ cmd_install_main() print_cmd_usage 'install' >&2 return 1 fi - shift $(($OPTIND - 1)) + shift $((${OPTIND} - 1)) if [ ${#} -lt 2 ]; then print_cmd_usage 'install' >&2 diff --git a/src/cmd/installer-pc.sh b/src/cmd/installer-pc.sh index 0c16ddf..19836c4 100644 --- a/src/cmd/installer-pc.sh +++ b/src/cmd/installer-pc.sh @@ -35,7 +35,7 @@ cmd_installer_pc_main() print_cmd_usage 'installer-pc' >&2 return 1 fi - shift $(($OPTIND - 1)) + shift $((${OPTIND} - 1)) if [ "x${cmd_installer_pc_opt_a-}" = 'x' ]; then print_cmd_usage 'installer-pc' >&2 diff --git a/src/cmd/mkinitramfs.sh b/src/cmd/mkinitramfs.sh index 41e6327..3177071 100644 --- a/src/cmd/mkinitramfs.sh +++ b/src/cmd/mkinitramfs.sh @@ -31,7 +31,7 @@ cmd_mkinitramfs_main() print_cmd_usage 'mkinitramfs' >&2 return 1 fi - shift $(($OPTIND - 1)) + shift $((${OPTIND} - 1)) if [ "x${cmd_mkinitramfs_opt_l-}" = 'x' ]; then print_cmd_usage 'mkinitramfs' >&2 diff --git a/src/control.sh b/src/control.sh index b25d00b..c8d742c 100644 --- a/src/control.sh +++ b/src/control.sh @@ -39,7 +39,7 @@ parse_control() in_paragraph='false' while IFS='' read -r line; do - control_line_nr=$(($control_line_nr + 1)) + control_line_nr=$((${control_line_nr} + 1)) if [ "x$(echo ${line})" = 'x' ]; then # Paragraph end. if ${in_paragraph}; then diff --git a/src/fd.sh b/src/fd.sh index c52efec..345eee6 100644 --- a/src/fd.sh +++ b/src/fd.sh @@ -60,7 +60,7 @@ fopen() fd=${i} break fi - i=$(($i + 1)) + i=$((${i} + 1)) done if [ "x${fd:+set}" != 'xset' ]; then error "$(get_msg 'emfile')" diff --git a/src/main.sh b/src/main.sh index 054363d..c26f5a6 100644 --- a/src/main.sh +++ b/src/main.sh @@ -65,7 +65,7 @@ main() cmd_help_main >&2 return 1 fi - shift $(($OPTIND - 1)) + shift $((${OPTIND} - 1)) if ${opt_h:-false}; then cmd='help' diff --git a/src/mutex.sh b/src/mutex.sh index fe74760..60ab07d 100644 --- a/src/mutex.sh +++ b/src/mutex.sh @@ -34,7 +34,7 @@ mutex_timedlock() while ! mutex_trylock "${mutex}"; do [ ${timeout} -eq 0 ] && return 1 - timeout=$(($timeout - 1)) + timeout=$((${timeout} - 1)) sleep 1 done diff --git a/src/profile/proteanos.sh b/src/profile/proteanos.sh index 6991937..fbf0124 100644 --- a/src/profile/proteanos.sh +++ b/src/profile/proteanos.sh @@ -99,7 +99,7 @@ prof_proteanos_select_mirror() 'http://files.proteanos.com/pub/proteanos-mirrors-http')" mirrors_count=$(printf '%s\n' "${mirrors}" | wc -l) rand - mirror_num=$(($rand_x % $mirrors_count + 1)) + mirror_num=$((${rand_x} % ${mirrors_count} + 1)) printf '%s\n' "${mirrors}" | sed -n "${mirror_num}p" } diff --git a/src/rand.sh b/src/rand.sh index 872d3fb..f2b3cd4 100644 --- a/src/rand.sh +++ b/src/rand.sh @@ -37,6 +37,6 @@ srand() rand() { # Increment, multiplier, and modulus values are those used in glibc. - rand_x=$((1103515245 * $rand_x + 12345)) - rand_x=$(($rand_x % 4294967296)) + rand_x=$((1103515245 * ${rand_x} + 12345)) + rand_x=$((${rand_x} % 4294967296)) } diff --git a/src/session.sh b/src/session.sh index 2ddf6ff..61211a4 100644 --- a/src/session.sh +++ b/src/session.sh @@ -196,7 +196,7 @@ session_set_sigs() i=0 session_sigs='' while [ ${i} -lt 127 ]; do - i=$(($i + 1)) + i=$((${i} + 1)) sig="$(kill -l ${i} 2>/dev/null)" || continue case "${sig}" in 'HUP' | 'INT' | 'QUIT' | 'ABRT' | 'ALRM' | 'TERM') @@ -213,5 +213,5 @@ session_handle_sig() session_end - exit $((128 + $sig)) + exit $((128 + ${sig})) } diff --git a/src/substvars.sh b/src/substvars.sh index c2bc3f8..38661c1 100644 --- a/src/substvars.sh +++ b/src/substvars.sh @@ -94,7 +94,7 @@ substvars() name="$(printf '%s\n' "${name}" | tr 'A-Z-' 'a-z_')" value="$(eval "printf '%s\n' \"\${substvar_${name}}\"")" string="${lhs}${value}${rhs}" - depth=$(($depth + 1)) + depth=$((${depth} + 1)) done printf '%s\n' "${string}" -- cgit v0.9.1