Started to re-write the dialog exercises to use Zenity instead

This commit is contained in:
2013-12-26 11:28:04 +01:00
parent a2135827e9
commit 5b2b8cb6ed
2 changed files with 42 additions and 0 deletions

33
Labb7/ovning1_zenity.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
# Jack-Benny Persson
# LX13
# Övning 1 (Make a menu that let's the user choose a web browser)
# Binaries
Zenity="/usr/bin/zenity"
Whereis="/usr/bin/whereis"
# Santiy checks
if [ ! -x $Zenity ]; then
echo "Can't excute $Zenity"
exit 2
fi
# Main
$Zenity --text "Choose a browser" --list --column="Start"\
--column "Browser" --radiolist FALSE firefox FALSE lynx FALSE links FALSE w3m\
> /tmp/browserchoice
Browser=`cat /tmp/browserchoice`
BinPath=`$Whereis $Browser | awk '{ print $2 }'`
echo $BinPath | grep / &> /dev/null
if [ $? -ne 0 ]; then
$Zenity --info --text="It seems you don't have $Browser installed"
exit 2
fi
$BinPath &
exit 0