![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| basic script for yes and no answers | llsmr777 | Shell Programming and Scripting | 10 | 05-08-2008 11:26 AM |
| I need help with a basic script | EECSDAVE | Shell Programming and Scripting | 4 | 12-10-2007 05:37 PM |
| Basic script? | kjbaumann | Shell Programming and Scripting | 1 | 10-10-2007 12:22 PM |
| Unix basic help | carrera911 | UNIX for Dummies Questions & Answers | 2 | 08-24-2006 07:28 PM |
| Basic unix | HipCracka | UNIX for Dummies Questions & Answers | 4 | 12-08-2003 02:00 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Need help with basic unix script
What I am supposed to do is creat a menu with the following
Find a song Find a album Sort by artist Delete a song Add a new song Quit Now the file with the song information is database Here is what I have so far #!/bin/bash #================================================= #Script Name: menu #By: Joe Teetzel #Date: May 9th # Purpose: A menu for Database # Command Line: menu #================================================= trap "rm ./f 2> /dev/null; exit" 0 1 3 database=~/database loop=y while test $loop = "y" do clear tput cup 10 52; echo "Songs Album and Artist Menu" tput cup 11 52; echo "===========================" tput cup 12 52; echo "S - Find a Song" tput cup 13 52; echo "A - Find a Album" tput cup 14 52; echo "I - Sort By Artist" tput cup 15 52; echo "E - Add New Song" tput cup 16 52; echo "D - Delete A Song" tput cup 17 52; echo "O - View Full List" tput cup 19 52; echo "Q- Quit" tput cup 19 62; read choice || continue case $choice in [Qq]) clear exit ;; [Ii]) ./artistsort ;; [Oo]) clear ; less $database ;; [Ss]) songfind=~/database clear tput cup 5 1 echo "Enter song to search for: " tput cup 5 35 read song echo grep $song $database | tr ':' ' ' echo echo "Press ENTER to continue" read continue ;; [Aa]) ./album=~database clear tput cup 5 1 echo "Enter album to search for: " tput cup 5 35 read album echo grep $album $database | tr ':' ' ' echo echo "Press Enter to continue" read continue ;; [Ee]) songadd=~/database looptest=y while [ $looptest = y ] do clear tput cup 1 52; echo "type in New Songs into here" tput cup 2 52; echo "===========================" tput cup 4 52; echo "Song Name : " tput cup 5 52; echo "Artist Name : " tput cup 6 52; echo "Album Name : " tput cup 8 52; echo "Add another? (y)es or (q)uit: " tput cup 4 66; read songname if [ "$songname" = "q" ] then clear; exit fi tput cup 5 66; read arname tput cup 6 66; read alname if [ "$arname" > " "] then echo "$songname:$arname:$alname" >> $songadd fi tput cup 12 13: read looptest if [ "looptest" = "q" ] then clear; exit read $choice [Dd]) clear tput cup 16 52; echo "Delete Song" tput cup 17 52 ; echo "Song: " tput cup 17 59 ; read song tput cup 18 52; echo "Accept? (y)es or (n)o: " tput cup 18 75; read Accept if test $Accept = "y" then sed /$song/d $database > f cp f $database rm f fi ;; *) tput cup 20 52; echo "Invalid Choice Please Choose Again"; read choice ;; esac done #CAN ANYONE TELL ME WHAT IS WRONG WITH IT AND WHY IT WILL NO WORK? #THANK YOU IN ADVANCE #btw I am running the bash shell Last edited by stp0052; 05-15-2007 at 02:36 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
by the way i am running fedora core redhat bash shell
|
|||
| Google The UNIX and Linux Forums |