Re: A question for a programmer
Keith Alen Vance wrote:
>
> I am going through a book on Linux programming. One of the examples does
> not work. I was wondering if someone could take a look at the script and
> see why it doesn't work. The program is exactly like the example from the
> book, in fact I downloaded it from www.wrox.com the
> publisher of the book Beginning Linux Programming. The part that doesn't
> work is the list_tracks section.
>
> Thank You,
> Keith
> nfn11988@naples.net
>
>
> list_tracks() {
> if [ "$cdcatnum" = "" ]; then
> echo no CD selected yet
> return
> else
> grep "$cdcatnum" $tracks_file > $temp_file
> set $(wc -l $temp_file)
> num_tracks=$1
> if [ "$num_tracks" = "0" ]; then
> echo no tracks found for $cdtitle
> else {
> echo
> echo "$cdtitle :-"
> echo
> cut -f 2- -d , $temp_file
> echo }| more
^^^^^^^^^^^^^^^^^^^^^
This look fishy. Is this a typo on your part?
> fi
> fi
> get_return
> return
> }
Normal bourne shell syntax does not use { } for blocks of code. You
just use if...fi, for....done, etc. What error do you get when you run
this? I have not grabbed the source and run it myself.
--
Unsubscribe? mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
Reply to: