menushell/menu

93 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
##############################################################################
#
# $0 - A simple shell-based menu system for navigating many tilde things
#
# Copyright 2022, by ubergeek <ubergeek@thunix.net
# Licensed under the AGPL 3 or later.
#
##############################################################################
if [ -f ~/menushell.conf ]
then
. ~/menushell.conf
fi
if [ -f ./menushell.conf ]
then
. ./menushell.conf
fi
tmpfile="/home/`whoami`/menu.tmp"
main () {
dialog --menu "Select an option:" 0 0 0 "mail" "" "shell" "" "wiki" "" "browser" "" "chat" "" "quit" "" 2>$tmpfile
return
}
quit () {
dialog --yesno "Do you want to exit?" 0 0
response=$?
case $response in
0)
clear
echo "Just type 'menu' to return!"
rm $tmpfile
exit 0;;
1)
break;;
esac
return
}
email () {
$mailer
return
}
wiki () {
$browser https://wiki.thunix.net
return
}
browser () {
$browser https://thunix.net
return
}
chat () {
$chat
return
}
shellout () {
clear
echo "Just type 'exit' to return to the menu."
$cli
return
}
main
selection=`cat $tmpfile`
case $selection in
mail)
email;;
shell)
shellout;;
wiki)
wiki;;
browser)
browser;;
chat)
chat;;
quit)
quit;;
esac
$0