summaryrefslogtreecommitdiff
path: root/graphical_prompt.sh
blob: e7bd846ce4ee7b897123b4491f736d6746075b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

help_message() {
	echo "Usage: $0 COMMAND [PROMPT_TEXT]"
	echo "Example: $0 \"shutdown now\" \"Log Off and Shutdown?\""
	exit
}

case $1 in
	"" | "-h" | "--help" ) help_message;;
esac

PROMPT=$2
if [ -z $2 ]; then
	PROMPT="Are you sure?"
fi
zenity --question --text="$PROMPT"
RES=$?

# 0 -> YES
# 1 -> NO

if [ $RES -eq 0 ]; then
	eval $1
fi