Alan D. Salewski on 19 Aug 2008 04:57:26 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] if command then foo else bar


On Tue, Aug 19, 2008 at 07:48:27AM -0400, David A. Harding spake thus:
> On Mon, Aug 18, 2008 at 11:35:06PM -0400, JP Vossen wrote:
> > At the PLUG West meeting, Toby asked about using a bash 'if' without a 
*snip*
> > This one bites me every once in a while too, since that's how it 
> > "logically" should work.  
> 
> That is how it works.  For example:
> 
> 	$ if false ; then echo "Hello, World" ; else echo "Goodbye, World" ; fi
> 	Goodbye, World
> 
> Or in a script:
> 
> 	if false
> 	then
> 		echo "Hello, World"
> 	else
> 		echo "Goodbye, World"
> 	fi
> 
> (Note: false is /bin/false, a GNU Coreutils command.)
*snip*

While that's true, the way 'false' is invoked above will invoke the bash
'false' builtin.


-- 
a l a n   d.   s a l e w s k i             salewski@worldnet.att.net
--------------------------------------------------------------------
                        Bruce is mad at me
                  you ask who the hell is bruce?
                         Bruce is my liver
--------------------------------------------------------------------
Generated from Haiku-O-Matic:           www.smalltime.com/haiku.html
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug