bug-bash
[Top][All Lists]
Advanced

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

Re: Bash style of if-then-else?


From: Joachim Schmitz
Subject: Re: Bash style of if-then-else?
Date: Tue, 24 Aug 2010 11:11:18 +0200

Pierre Gaston wrote:
On Tue, Aug 24, 2010 at 10:25 AM, Joachim Schmitz
<address@hidden> wrote:
Chris F.A. Johnson wrote:

On Mon, 23 Aug 2010, Dennis Williamson wrote:

If you're writing a Bash-specific script then it's preferable to
use double square brackets (see
http://mywiki.wooledge.org/BashFAQ/031).

if [[ -f $file ]]
then
do something
fi

I'd avoid non-portable syntax unless it offers a significant
advantage over standard syntax.

[[ ... ]] is not standard, and offers little over the standard
syntax.

[[ ... ]] is POSIX, isn't it? As such there should be enough
portability and standard syntax to warrant the advantage.

[[ ]] is reserved but not specified.

Ah, OK, found it: http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

The following words may be recognized as reserved words on some implementations (when none of the characters are quoted), causing unspecified results:

       [[
      ]]
      function
      select




Bye, Jojo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]