Posts

Showing posts with the label menu

Moving text menus to the gui.

Image
Take your standard menu and with a little help it can become gui friendly. Original code: #! /bin/bash echo "************************" echo "* Music programs       *" echo "************************" echo "* [1] Autoharp         *" echo "* [2] Radio            *" echo "*                      *" echo "* [0] Exit/Stop        *" echo "************************" echo echo "Enter your menu choice [1-2, or 0]: " read -n 1 yourch case $yourch in 1) autoharp.sh  ;; 2) radio.sh ;; 0) exit 0 ;; *) echo "Oopps!!! Please select choice 1,2 or 0" echo "Press Enter to continue. . ." ; read ;; esac done Which generates: Or you could go to a mouse friendly gui: #! /bin/bash while selection=$(zenity --lis...

Looks may be decieving

Image
Wanted a simple business program that I could run on a minimal or embedded machine that emulated the old Fish Market dbase example from years ago. Probably could of used Harbour software, but was not happy with it. Dbase is no longer around, so I can not run it on Linux.  Could always use an sql program to control the database. Decided to use bash as the front end, Next was to see how hard it would be to emulate the the screens generated in Dbase. Commented in an earlier article that it is good to know several languages. Here even knowing just a minimal amount about the dbase language allowed there to be a port of the code. Two examples of the code where one was done with dbase and the other was done in bash. Fortunately I was able to convert the main menu for starters. Here are the two screen shots accomplishing the same goal of a main menu: Actually it was not that hard to port the code from dbase to bash so far. In fact the code for both looks a lot the same. Dbase...

Menu please...

Image

Bash menu starter

Image
Starter menu to show you the power of tput. [code] #!/bin/bash #testmenu.sh #test for tput cursor movements #colour the screen tput setb 3 #Green in xterm and brown in linux terminal tput clear #paint menu onto the screen echo "" echo "" echo "TEST MENU" echo "1 ..... ECHO 1" echo "2 ..... ECHO 2" echo "3 ..... ECHO 3" echo "4 ..... QUIT" echo "" echo "Select item: " #loop around gathering input until QUIT is more than 0 QUIT=0 while [ $QUIT -lt 1 ] do #Move cursor to after select message tput cup 8 13 #Delete from cursor to end of line tput el read SEL if [ ${#SEL} -lt 1 ] then continue fi if [ $SEL -eq 4 ] then QUIT=1 continue fi #put message in middle of screen tput cup 15 20 #Delete from cursor to end of line tput el case $SEL in *) echo "You selected $SEL";; esac done #reset the screen #Find out if this is a "linux" virtual...

Translate source code.

Translating from one batch file system to another can be interesting. As a former admin, I had to do that with Novell scripts and convert them to MSWindows batch files when we were changing systems. Someone wrote a batch file for emulate a menu to launch the browser to go to different sites that could of been a bit more precise for dos, but I decided to translate it to bash. Dos: @echo off color 0e Title Website Starter (by Prof. Pickle) :Menu cls echo --------------------------------------------------------------------- echo This is the Website starter echo. echo Select the number of the website you wish to select echo Or press E to exit. echo --------------------------------------------------------------------- echo. echo. echo 1. facebook echo 2. youtube echo 3. google echo 4. redtube echo 5. other set /p web= If %web% EQU 1 start www.facebook.com If %web% EQU 1 goto Menu If %web% EQU 2 start www.youtube.com If %web% EQU 2 goto Menu If %web% EQU 3 start www.google.com If %web% EQ...

Home web server menu.

Image
Use your home web server as a menu for your household. Touchpads could be used to access the menuing system.

Your place..

Image
Do not you wish you could charge for food at home?