get_return() { echo -e Press return c read (Web site templates)
get_return() { echo -e Press return c read xreturn 0} get_confirm() { echo -e Are you sure? c while truedoread xcase $x iny | yes | Y | Yes | YES ) return 0;; n | no | N | No | NO ) echo echo Cancelled return 1;; *) echo Please enter yes or no ;; esacdone} 4.Here we come to the main menu function, set_menu_choice. The contents of the menu varydynamically, with extra options being added if a CD entry has been selected. set_menu_choice() { clearecho Options :- echoecho a) Add new CD echo f) Find CD echo c) Count the CDs and tracks in the catalog if [ $cdcatnum != ]; thenecho l) List tracks on $cdtitle echo r) Remove $cdtitle echo u) Update track information for $cdtitle fiecho q) Quit echoecho -e Please enter choice then press return c read menu_choicereturn} 5.Here are two more very short functions, insert_titleand insert_track, for adding tothe database files. Though some people hate one-liners like these, they help make other func- tions clearer. Note that echo -emay not be portable to some shells. 84Chapter