maillog: 04/02/2005-00:00:41(+0000): Ciaran McCreesh types
> Hi people,
> 
> Just a note on how to do if / then / else blocks properly in bash... The
> following style *won't* work, so don't do anything daft like committing
> it to eutils.eclass without testing and h0rking half the tree, okay?
> 
> if foo ; then
>     # do nothing
> else
>     echo "hi"
> fi
> 
> You have to have a real genuine statement inside each block. Otherwise,
> bash will cry.
> 
> If The Doc existed, which it doesn't, and it wasn't in super-early-draft
> state, which it would be if it did exist, you'd be able to see this at
> [1]. As it is, you'll just have to read the bash docs.
> 
> [1]:
> http://dev.gentoo.org/~ciaranm/docs/IGNORE_the-doc/#multiple-selection

You could mention that a ":" would do the trick:

if foo ; then
    # do nothing
    :
else
    echo "hi"
fi


-- 
-*   Georgi Georgiev   -* You got to be very careful if you don't      -*
*-    [EMAIL PROTECTED]    *- know where you're going, because you might   *-
-*  +81(90)6266-1163   -* not get there. -- Yogi Berra                 -*

Attachment: pgpmcR9NqCplg.pgp
Description: PGP signature

Reply via email to