summaryrefslogtreecommitdiff
path: root/graphical_prompt.sh
diff options
context:
space:
mode:
Diffstat (limited to 'graphical_prompt.sh')
-rwxr-xr-xgraphical_prompt.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/graphical_prompt.sh b/graphical_prompt.sh
new file mode 100755
index 0000000..6b82104
--- /dev/null
+++ b/graphical_prompt.sh
@@ -0,0 +1,26 @@
+#!/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
+echo $PROMPT
+zenity --question --text="$PROMPT"
+RES=$?
+
+# 0 -> YES
+# 1 -> NO
+
+if [ $RES -eq 0 ]; then
+ eval $1
+fi