Tested out dialog a bit

This commit is contained in:
Jack-Benny Persson 2013-12-24 16:11:10 +01:00
parent 187223e542
commit eb98644bed
5 changed files with 67 additions and 5 deletions

0
Labb7/editor Normal file
View File

View File

@ -5,22 +5,23 @@
# Testing out dialog
# Variables
$Dialog="/usr/bin/dialog"
Dialog="/usr/bin/dialog"
# Sanity check
if [ ! -x $Dialog ]; then
echo "Can't execute $Dialog"
exit 2
fi
# Main
dialog --backtitle "Epic App" --msgbox \
$Dialog --backtitle "Epic App" --msgbox \
"Welcome to Epic App, hit enter to continue" 10 60
if [ $? -ne 0 ]; then
echo "Quitting"
exit 1
fi
dialog --backtitle "Epic App" --title "U sure?" --yesno \
$Dialog --backtitle "Epic App" --title "U sure?" --yesno \
"Are you sure you want to continue?" 10 60
if [ $? -eq 1 ]; then
echo "Okay, you said no, quitting"
@ -35,10 +36,10 @@ if [ $? -ne 0 ]; then
exit 2
fi
dialog --backtitle "Epic App" --infobox "Booting up..." 10 60
$Dialog --backtitle "Epic App" --infobox "Booting up..." 10 60
sleep 3
dialog --backtitle "Epic App" --pause "Waiting to get ready..." 10 60 5
$Dialog --backtitle "Epic App" --pause "Waiting to get ready..." 10 60 5
if [ $? -eq 254 ]; then
echo "Ok, aborting"
exit 2

16
Labb7/test_dialog_checklist.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Testing checklists in dialg
dialog --checklist "Choose your editor" 10 60 3 \
vi "The vi editor" off emacs "The Emacs editor" \
off nano "The nano editor" off 2> /tmp/editorchoice
Editor=`cat /tmp/editorchoice | sed 's/\"//g'`
echo "You chose the $Editor editor, starting"
$Editor
exit 0

22
Labb7/test_dialog_inputbox.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Testing inputboxes
# Binaries
Dialog="/usr/bin/dialog"
# Santiy check
if [ ! -x $Dialog ]; then
echo "Can't execute $Dialog"
exit 2
fi
# Main
$Dialog --inputbox "Your name" 10 60 2> /tmp/namefrombox
Name=`cat /tmp/namefrombox`
$Dialog --msgbox "Your name is $Name" 10 60
exit 0

23
Labb7/test_dialog_menu.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Testing menus with dialog
# Binaries
Dialog="/usr/bin/dialog"
# Sanity check
if [ ! -x $Dialog ]; then
echo "Can't excute $Dialog"
exit 2
fi
$Dialog --menu "Choose your editor" 10 60 3 vi "The vi Editor"\
emacs "The emacs Editor" nano "The nano Editor" 2> /tmp/editorchoice
Editor=`cat /tmp/editorchoice`
$Dialog --msgbox "You selected $Editor" 10 60
exit 0