Use -z instead of checking if equal to ""

This commit is contained in:
BBaoVanC 2021-04-29 16:48:23 -05:00
parent baac624468
commit edfc35ce34
No known key found for this signature in database
GPG key ID: 18089E4E3CCF1D3A

View file

@ -7,7 +7,7 @@ use_height=""
while :; do while :; do
case "$1" in case "$1" in
"--nsfw"|"nsfw"|"-n"|"n") "--nsfw"|"nsfw"|"-n"|"n")
if [ "$imgtype" = "" ]; then if [ -z "$imgtype" ]; then
[ "$DEBUG" = "true" ] && echo "Getting a nsfw image" [ "$DEBUG" = "true" ] && echo "Getting a nsfw image"
imgtype="nsfw" imgtype="nsfw"
else else
@ -15,7 +15,7 @@ while :; do
fi fi
;; ;;
"--sfw"|"sfw"|"-s"|"s") "--sfw"|"sfw"|"-s"|"s")
if [ "$imgtype" = "" ]; then if [ -z "$imgtype" ]; then
[ "$DEBUG" = "true" ] && echo "Getting a sfw image" [ "$DEBUG" = "true" ] && echo "Getting a sfw image"
imgtype="sfw" imgtype="sfw"
else else
@ -27,7 +27,7 @@ while :; do
use_w3m="true" use_w3m="true"
;; ;;
"--height"|"-h") "--height"|"-h")
if [ "$use_height" = "" ]; then if [ -z "$use_height" ]; then
use_height="$2" use_height="$2"
[ "$DEBUG" = "true" ] && echo "Using height $height" [ "$DEBUG" = "true" ] && echo "Using height $height"
else else
@ -51,7 +51,7 @@ else
imgurl="https://nekos.life/api/v2/img/neko" imgurl="https://nekos.life/api/v2/img/neko"
fi fi
if [ "$use_height" != "" ]; then if [ ! -z "$use_height" ]; then
height="$use_height" height="$use_height"
else else
height="$(($(stty size | awk '{print $1}') - 5))" height="$(($(stty size | awk '{print $1}') - 5))"