On Fri, 2021-03-19 at 07:24 -0400, Scott Andrews wrote:
> On Fri, 19 Mar 2021 07:09:06 +0100
> Pierre Labastie <pierre.labas...@neuf.fr> wrote:
> 
> > 
> > Using brackets depends on "something". If something is a predicate,
> > you need brackets. If something is a (compound) command, no
> > brackets. I've not looked in details at the "if" in the boot
> > scripts, but they must be correct in this respect, since they seem
> > to work...
> > 
> 
> By brackets are you talking about [ ] or [[ ]]?
> 
> if [ something ]; then this; fi,
> 
> Really means
> 
> if test something; then this; fi
> 
> [ is actually test, and the [ must be followed by ]
> 
> [[ ]]  is an expression
> 
> See the gnu bash reference manual for clarification.
> 

Here is an experiment:
---
pierre [ ~ ]$ toto () {
> return 1
> }
pierre [ ~ ]$ if toto; then echo true; else echo false; fi
false
pierre [ ~ ]$ if [ toto ]; then echo true; else echo false; fi
true
---

Pierre

-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to