[kwlug-disc] Outsmarted by bash && if

Khalid Baheyeldin kb at 2bits.com
Wed Apr 7 20:25:13 EDT 2010


How about:

if [ -n "$STICK" -a -n "$STATUS" ]; then
             /sbin/ifup ppp0
fi

On Wed, Apr 7, 2010 at 8:21 PM, Lori Paniak <ldpaniak at fourpisolutions.com>wrote:

> Dear very clever list,
>
> I am trying to write a simple bash script to (re)start a process given
> the logical "and" of two conditions.  I think it should look like this:
>
> if [ -n "$STICK" ] && [ -n "$STATUS" ]; then
>              /sbin/ifup ppp0
> fi
>
> When STICK and STATUS are non-empty strings I would like ifup to run.
> This works if I just use one condition, but I cannot figure out the
> correct syntax for the AND-ed case.  I've tried (seemingly) all
> combinations and locations of brackets without success.
>
> Anyone out there care to point out my trivial error(s)?
>
> Thanks!
> Lori
>
> _______________________________________________
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
>
>


-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20100407/b5fbc005/attachment.htm>


More information about the kwlug-disc mailing list