On Fri, 27 Aug 1999, Chris Costello wrote:

> On Thu, Aug 26, 1999, Doug wrote:
> > > > 2. value ) instead of value) for case statements
> > > 
> > >    Why?  What's wrong with `value)'?
> > 
> > Nothing functionally, but I find case statements much easier to read with
> > the extra whitespace. 
> 
>    Would that not cause problems?

        Nope. As most things shell it (rightly) ignores the whitespace.
Take a look at this little script to prove it to yourself:

#!/bin/sh

VAR=foo

case $VAR in

        foo )
                echo "I don't care about whitespace"
                ;;
        foo)
                echo "OOoops, guess I do"
                ;;
esac

VAR='foo '

case $VAR in

        foo )
                echo "D'oh! I see the whitespace in the variable"
                ;;
        foo)
                echo "D'oh! I don't see the whitespace in the variable"
                ;;
        'foo ' )
                echo "I see what I am supposed to see"
                ;;
esac

Doug



To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to