In the following Try It Out section, just (Web design course)
In the following Try It Out section, just so you don t get totally lost, we ll be using the following functions: get_return() get_confirm() set_menu_choice() insert_title() insert_track() add_record_tracks() add_records() find_cd() update_cd() count_cds() remove_records() list_tracks() Try It Out A CD Application1.First in our sample script is, as always, a line ensuring that it s executed as a shell script, fol- lowed by some copyright information: #!/bin/sh# Very simple example shell script for managing a CD collection. # Copyright (C) 1996-2003 Wrox Press. # This program is free software; you can redistribute it and/or modify it# under the terms of the GNU General Public License as published by the# Free Software Foundation; either version 2 of the License, or (at your# option) any later version. # This program is distributed in the hopes that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General# Public License for more details. # You should have received a copy of the GNU General Public License along# with this program; if not, write to the Free Software Foundation, Inc. # 675 Mass Ave, Cambridge, MA 02139, USA. 2.The first thing to do is to ensure that some global variables that we ll be using throughout are set up. We set the title and track files and a temporary file. We also trap Ctrl+C,so temporary file will be removed if the user interrupts the script. menu_choice= current_cd= title_file= title.cdb tracks_file= tracks.cdb temp_file=/tmp/cdb.$$ trap rm -f $temp_file EXIT3.Now we define our functions, so that the script, executing from the top line, can find all thefunction definitions before we attempt to call any of them for the first time. To avoid rewritingthe same code in several places, the first two functions are simple utilities.