[CLUE-Tech] shell programming
David Guntner
davidg at akaMail.com
Thu Dec 12 02:38:33 MST 2002
Lynn Danielson grabbed a keyboard and wrote:
>
> On Wed, 2002-12-11 at 04:13, David Guntner wrote:
> >
> > #!/bin/bash
> >
> > if [ $LOGNAME = "root" ]; then
> > echo "Hello root"
> > else
> > echo "You aren't root"
> > fi
>
> A minor point about the test statement. It is more important to
> quote your variables rather than your constants. For example,
> [ "$LOGNAME" = root ]. Then if your variable is null, the test
> won't throw an error.
Oh yea, that's absolutely true. Got my quotes around the wrong part. :-)
Thanks for pointing that out.
==Dave
--
David Guntner GEnie: Just say NO!
http://www.akaMail.com/pgpkey/davidg or key server
for PGP Public key
More information about the clue-tech
mailing list