From 937b047c2a08e99cfd2a329d94ed34a041b9744a Mon Sep 17 00:00:00 2001 From: xyz Date: Fri, 13 Aug 2021 01:46:46 -0700 Subject: use $(()) intead of echo to bc --- .local/bin/convwall | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to '.local/bin') diff --git a/.local/bin/convwall b/.local/bin/convwall index 9db84d06..7ef49a9f 100755 --- a/.local/bin/convwall +++ b/.local/bin/convwall @@ -9,16 +9,16 @@ chopnum=99% width=$(identify -format '%w' "$1") height=$(identify -format '%h' "$1") -ratio=$(echo "$wratio*100/$hratio" | bc) -dim=$(echo "$width*100/$height" | bc) +ratio=$((wratio*100/hratio)) +dim=$((width*100/height)) if [ "$dim" -ne "$ratio" ]; then if [ "$dim" -lt "$ratio" ]; then chopgeom="${chopnum}x0" - width=$(echo "$height*$wratio/$hratio" | bc) + width=$((height*wratio/hratio)) else chopgeom="0x$chopnum" - height=$(echo "$width*$hratio/$wratio" | bc) + height=$((width*hratio/wratio)) fi # may throw error "sort: write failed: 'standard output': Broken pipe \n sort: write error" # caused by head exit (or close stdin) before sort output complete, can ignore -- cgit v1.2.3-70-g09d2