Skip to content

Commit

Permalink
switched from which to more-portable command -v
Browse files Browse the repository at this point in the history
  • Loading branch information
lunarcloud committed Jun 9, 2024
1 parent 0d88d54 commit 69c0bde
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions script-dialog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ if [ -z ${GUI+x} ]; then
fi

if [ "$GUI" == "true" ] ; then
if which -s kdialog; then
if command -v >/dev/null kdialog; then
hasKDialog=true
fi

if which -s zenity; then
if command -v >/dev/null zenity; then
hasZenity=true
fi
else
if which -s dialog; then
if command -v >/dev/null dialog; then
hasDialog=true
fi

if which -s whiptail; then
if command -v >/dev/null whiptail; then
hasWhiptail=true
fi
fi
Expand Down Expand Up @@ -97,15 +97,15 @@ fi
# which sudo to use
NO_SUDO=false
SUDO_USE_INTERFACE=false
if [ "$GUI" == "true" ] && which -s pkexec; then
if [ "$GUI" == "true" ] && command -v >/dev/null pkexec; then
SUDO="pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY"
elif [ "$INTERFACE" == "kdialog" ] && which -s gksudo; then
elif [ "$INTERFACE" == "kdialog" ] && command -v >/dev/null gksudo; then
SUDO="kdesudo"
elif [ "$GUI" == "true" ] && which -s gksudo; then
elif [ "$GUI" == "true" ] && command -v >/dev/null gksudo; then
SUDO="gksudo"
elif [ "$GUI" == "true" ] && which -s gksu; then
elif [ "$GUI" == "true" ] && command -v >/dev/null gksu; then
SUDO="gksu"
elif which -s sudo; then
elif command -v >/dev/null sudo; then
SUDO="sudo"
if [ "$INTERFACE" == "whiptail" ] || [ "$INTERFACE" == "dialog" ]; then
SUDO_USE_INTERFACE=true
Expand Down Expand Up @@ -151,7 +151,7 @@ MAX_HEIGHT=$MIN_HEIGHT
MAX_WIDTH=$MIN_WIDTH

function updateDialogMaxSize() {
if ! which -s tput; then
if ! command -v >/dev/null tput; then
return;
fi

Expand Down

0 comments on commit 69c0bde

Please sign in to comment.