[OT] xkcd
Tom Buskey
tom at buskey.name
Mon Oct 15 09:03:46 EDT 2007
On 10/14/07, Ben Scott <dragonhawk at gmail.com> wrote:
>
> On 10/13/07, John Abreau <jabr at blu.org> wrote:
> >> Of course, if you're using bash, then
> >> http://xkcd.com/{1..327}
> >
> > Depends on what version of bash.
>
> That's why we should be using
>
> #!/bin/bash-3.2.9
>
> at the top of our shell scripts.
How about this:
#!/bin/bash
# fails if bash changes "GNU bash, version " prefix
VER=$(bash --version | head -1 |cut -c19)
case $VER
1,2)
echo "Fails"
;;
*)
echo "http://xkcd.com/{1..327}"
;;
esac
If the {n...m} syntax changes in a future version of bash, you'll need to
change the case.
It'd be nice if --version wasn't so wordy or you could get just the version
like uname -r
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.gnhlug.org/mailman/private/gnhlug-discuss/attachments/20071015/61e10806/attachment.html
More information about the gnhlug-discuss
mailing list