Programming
Need help with C, C++, perl, python, etc?
However, I am not looking for "help" really, After doing some searches, and also
using the manuals that comes with "fortune", "bash", and "dialog" the examples that come with the "Dialog" program, I came up with this :
Code: Select all
#!/bin/bash
#A menu example based on the menu example in dialog
#Also to give credit where it is due , http://linuxcommand.org/lc3_adv_dialog.php
#is where I found the menu example, improved and the basic bash script
#I only needed to modify a little.
DIALOG_CANCEL=1
DIALOG_ESC=255
HEIGHT=0
WIDTH=0
display_result() {
dialog --title "$1" \
--no-collapse \
--msgbox "$result" 0 0
}
while true; do
exec 4>&1
selection=$(dialog \
--backtitle "Bible Verses and Fortunes" \
--title "Menu" \
--clear \
--cancel-label "Exit" \
--menu "Please select:" $HEIGHT $WIDTH 4 \
"1" "Fortune Bible Verses" \
"2" "Display Daily Verse" \
"3" "Display Fortune " \
"4" "Spanish Fortune"\
2>&1 1>&4)
exit_status=$?
exec 3>&-
case $exit_status in
$DIALOG_CANCEL)
clear
echo "Program terminated."
exit
;;
$DIALOG_ESC)
clear
echo "Program aborted." >&2
exit 1
;;
esac
case $selection in
0 )
clear
echo "Program terminated."
;;
1 )
result=$(fortune kjv)
display_result "KJV Verses"
;;
2 )
result=$(verse)
display_result "Daily Verse"
;;
3 )
result=$(fortune)
display_result "Fortune"
;;
4 )
result=$(fortune kjv-es-1)
display_result "Spanish KJV"
;;
esac
done
Here is what it looks like :
Using this to help with translating,.. :
apertium(1) apertium(1)
NAME
apertium - This application is part of ( apertium )
This tool is part of the apertium machine translation architec‐
ture: http://apertium.sf.net.