LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices


Rate this Entry

dbase menus to bash.

Posted 11-20-2014 at 01:30 AM by peonuser
Updated 11-20-2014 at 01:35 AM by peonuser

Wondered if there could be a way to mimic the old dbase menus from Freddies Fish market in bash . This what I came up with:

Dbase:
mainmenu.prg

**************************************
* *
* Main *
* Eddie's fish market *
* main menu *
* main.prg *
* *
**************************************
set catalog to fredfish
set catalog on
set delimiter off
set echo off
set exact off
set talk off
set bell off
set confirm off
set intensity on
set status off
set deleted on
store .f. to exit
store ' ' to option
clear
do while .not. exit
@ 1,20 say "Eddie's Friendly Fish Market"
@ 3,20 say ' Main Menu'
@ 7,20 say 'Enter selection: ' ;
get option
@ 10,22 say '1 - Customer system'
@ 11,22 say '2 - Employee system'
@ 12,22 say '3 - Order system'
@ 13,22 say '4 - Inventory system'
@ 15,22 say 'X - Exit system'
@ 21,12 say 'Copyright (c) 1994 by tabby little books'
@ 22,12 say 'Copyright (c) 1994 by kermit the phrog'
read
do case
case option = '1'
do customer
case option = '2'
do employee
case option = '3'
do order
case option = '4'
do inventory
case upper(option) = 'X'
return
otherwise
? chr(7)
@ 5,18 say '*** invalid entry - retray again ***'
endcase
store ' ' to option
enddo

Bash:
mainmenu.sh

#!/bin/bash
#**************************************
#* *
#* Main *
#* Eddie's fish market *
#* main menu *
#* main.sh *
#* *
#**************************************
#===============================
# Functions
#--------------------------------
# pc = position cursor
function pc () {
tput cup $1 $2
}
#===============================
# daffinitons
#-------------------------------
# set catalog to fredfish
# set catalog on
# set delimiter off
# set echo off
# set exact off
# set talk off
# set bell off
# set confirm off
# set intensity on
# set status off
# set deleted on
# true="-1"
exit="f"
option=" "
#=====================================
# main menu
#-------------------------------------
clear
while true; do
pc 1 20 ; echo "Eddie's Friendly Fish Market"
pc 3 20 ; echo ' Main Menu'
pc 7 20 ; echo 'Enter selection: '
pc 10 22 ; echo '1 - Customer system'
pc 11 22 ; echo '2 - Employee system'
pc 12 22 ; echo '3 - Order system'
pc 13 22 ; echo '4 - Inventory system'
pc 15 22 ; echo 'X - Exit system'
pc 21 12 ; echo 'Copyright (c) 2014 by computothought'
pc 22 12 ; echo 'Copyright (c) 2014 by computoman'
pc 7 37
read -s -n1 option
case $option in
[1] )
./customer.sh
;;
[2] )
./employee.sh
;;
[3] )
./order.sh
;;
[4] )
./inventory.sh
;;
[xX] )
pc 25 1
break
;;
*)
# printf '\a' ;
# beep
pc 5 18; echo '*** invalid entry - retry again ***'
;;
esac
option=" "
done
#-----------------------------------------------
# end of code
#================================================
Posted in Uncategorized
Views 951 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 01:19 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration