Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #239053
| From | Jude DaShiell <jdashiel@panix.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: bbc script |
| Date | 2021-08-19 19:10 +0200 |
| Message-ID | <CNTId-3Xl-1@gated-at.bofh.it> (permalink) |
| References | <CNM41-7ca-1@gated-at.bofh.it> <CNMGK-7GK-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Thanks to all who have replied. It turns out too much code was on case
statement and once I cleared that the script now works as expected.
Here's the working version:
#!/usr/bin/env bash
# file: bbc.sh
PS3="Enter a number to Choose station: "
select station in bbc1 bbc-1-extra bbc-2 bbc-3 bbc-4 \
b bc-4-long-wave-and-shipping bbc-4-extra bbc-5 \
bbc-6-music bbc-world-service quit
do
case $REPLY in
1)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_radio_one.pls
;;
2)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_1xtra.pls
;;
3)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_radio_two.pls
;;
4)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_radio_three.pls
;;
5)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_radio_fourfm.pls
;;
6)
mpv http://open.live.bbc.co.uk/mediaselector/5/select/mediaset/http-icy-mp3-a/format/pls/proto/http/vpid/bbc_radio_fourlw.pls
;;
7)
mpv http://stream.live.vc.bbcmedia.co.uk/bbc_radio_four_extra
;;
8)
mpv http://stream.live.vc.bbcmedia.co.uk/bbc_radio_five_live_online_nonuk
;;
9)
mpv http://stream.live.vc.bbcmedia.co.uk/bbc_6music
;;
10)
mpv http://stream.live.vc.bbcmedia.co.uk/bbc_world_service
;;
11)
exit 0
;;
esac
done
On Thu, 19 Aug 2021, Thomas Schmitt wrote:
> Hi,
>
> Jude DaShiell wrote:
> > select station in bbc1 bbc-1-extra bbc-2 bbc-3 bbc-4 \
> > b bc-4-long-wave-and-shipping
> > bbc-4-extra bbc-5 \
> > bbc-6-music bbc-world-service quit
> > do
> > case $REPLY in
> > $REPLY==1)
>
> man bash says about "case" that before ")" are patterns which are tested
> whether they match.
> So the text snippet "$REPLY==" before "1)" looks wrong.
>
> This litle experiment works for me:
>
> select station in AAA BB CC quit
> do
> echo $REPLY
> case $REPLY in
> 1) echo aaa
> ;;
> 2) echo bb
> ;;
> 3) echo cc
> ;;
> 4) break
> ;;
> esac
> done
>
> (As C programmer i am more into "if"-"elif"-chains than into "case", though.)
>
>
> Have a nice day :)
>
> Thomas
>
>
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
bbc script Jude DaShiell <jdashiel@panix.com> - 2021-08-19 11:00 +0200
Re: bbc script "Thomas Schmitt" <scdbackup@gmx.net> - 2021-08-19 11:40 +0200
Re: bbc script Jude DaShiell <jdashiel@panix.com> - 2021-08-19 19:10 +0200
Re: bbc script rhkramer@gmail.com - 2021-08-19 14:30 +0200
Re: bbc script Greg Wooledge <greg@wooledge.org> - 2021-08-19 14:40 +0200
Re: bbc script Jude DaShiell <jdashiel@panix.com> - 2021-08-20 01:50 +0200
Re: bbc script Greg Wooledge <greg@wooledge.org> - 2021-08-20 03:00 +0200
Re: bbc script <tomas@tuxteam.de> - 2021-08-20 09:40 +0200
Re: bbc script "Thomas Schmitt" <scdbackup@gmx.net> - 2021-08-19 15:10 +0200
csiph-web