[Gllug] Yes or no?

Nix nix at esperi.org.uk
Mon Nov 28 18:58:12 UTC 2005


On Mon, 28 Nov 2005, Ben Fitzgerald murmured woefully:
> #!/bin/bash
> 
> read x
> 
> case $x in
> [yY][eE][sS]) echo thanks for saying yes;;
> [yY]) echo thanks for saying yes;;
> *) echo arrrggh;;
> esac

ITYM

#!/bin/bash
read x
case $x in
 [yY]*) echo thanks for saying yes;;
esac

which also lets you say yeah, yep, and so on.

(in any case your first example is better expressed as

[yY][eE][sS]|[yY])

as | is supported in case.)

-- 
`Y'know, London's nice at this time of year. If you like your cities
 freezing cold and full of surly gits.' --- David Damerell

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list