If height argument isn't a number, automatically choose size

This commit is contained in:
BBaoVanC 2021-01-04 20:46:28 -06:00
parent 9f4fb0960b
commit 0c0b8f71bd
No known key found for this signature in database
GPG key ID: 18089E4E3CCF1D3A

View file

@ -24,7 +24,7 @@ case "$1" in
;;
esac
height=${2:-$(($(stty size | awk '{print $1}') - 5))}
echo "$2" | grep -qE '^[0-9]+$' && height="$2" || height="$(($(stty size | awk '{print $1}') - 5))"
echo "Using height $height"
url=$(curl -fsSL "$imgurl" | jq -r ".url")