Tested out dialog a bit
This commit is contained in:
parent
187223e542
commit
eb98644bed
0
Labb7/editor
Normal file
0
Labb7/editor
Normal file
@ -5,22 +5,23 @@
|
|||||||
# Testing out dialog
|
# Testing out dialog
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
$Dialog="/usr/bin/dialog"
|
Dialog="/usr/bin/dialog"
|
||||||
|
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if [ ! -x $Dialog ]; then
|
if [ ! -x $Dialog ]; then
|
||||||
echo "Can't execute $Dialog"
|
echo "Can't execute $Dialog"
|
||||||
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Main
|
# Main
|
||||||
dialog --backtitle "Epic App" --msgbox \
|
$Dialog --backtitle "Epic App" --msgbox \
|
||||||
"Welcome to Epic App, hit enter to continue" 10 60
|
"Welcome to Epic App, hit enter to continue" 10 60
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Quitting"
|
echo "Quitting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
"Are you sure you want to continue?" 10 60
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
echo "Okay, you said no, quitting"
|
echo "Okay, you said no, quitting"
|
||||||
@ -35,10 +36,10 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dialog --backtitle "Epic App" --infobox "Booting up..." 10 60
|
$Dialog --backtitle "Epic App" --infobox "Booting up..." 10 60
|
||||||
sleep 3
|
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
|
if [ $? -eq 254 ]; then
|
||||||
echo "Ok, aborting"
|
echo "Ok, aborting"
|
||||||
exit 2
|
exit 2
|
||||||
|
16
Labb7/test_dialog_checklist.sh
Executable file
16
Labb7/test_dialog_checklist.sh
Executable 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
22
Labb7/test_dialog_inputbox.sh
Executable 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
23
Labb7/test_dialog_menu.sh
Executable 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
|
Loading…
x
Reference in New Issue
Block a user