gaboshlib/gaboshlib/g_yesno.bashfunc
2022-07-06 12:24:21 +02:00

14 lines
307 B
Bash

#!/bin/bash
function g_yesno {
if [ -z $DISPLAY ]
then
read -p "$@ y/n" -n 1 -r g_yesno
echo
[[ ! $g_yesno =~ ^[Yy]$ ]] && g_echo_error_exit "Exited because answer was no!"
else
zenity --question --text="$@" --default-cancel --no-wrap || g_echo_error_exit "Exited because answer was no!"
fi
}