[Linux-disciples] Equivalent bash syntaxes

Stephen R Laniel steve at laniels.org
Mon Jul 21 11:31:55 EDT 2008


Is there any reason to prefer any of the
following three forms to either of the
other two?

- test expression && action

- if test expression; then
      action
  fi

- if [ expression ]; then
      action
  fi

I would guess that the versions
featuring test(1) would be more
portable, but I would also guess that
most modern shells support the [ ... ]
syntax. So is this a "six of one,
half-dozen of another" thing?

-- 
Stephen R. Laniel
steve at laniels.org
Cell: +(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key


More information about the Linux-disciples mailing list