[PLUG] bash test...

Steve Beattie steve at nxnw.org
Mon Apr 25 16:34:29 UTC 2011


On Fri, Apr 22, 2011 at 08:42:27PM -0700, Russell Johnson wrote:
> On Apr 22, 2011, at 6:26 PM, Robert Citek wrote:
> > Works for me:
> > 
> > $ EBS="/net/dbvol"
> > 
> > $ if [ "${EBS}" == "/net/dbvol" ]; then echo yes ;else echo no ; fi
> > yes
> 
> Making it a single equal sign resolved the issue. 
> 
> I am using bash 4.1.5 on Ubuntu 10.04.

Note that in Ubuntu and Debian, /bin/sh is dash, not bash, which is
more strict in its posix sh(1) conformance ('==' for string comparisons
is a bashism). Login shells by default use bash, but shell scripts,
unless explicitly using bash via "#!/bin/bash" will by default be
interpreted by dash.

The checkbashisms script from the devscripts package on Debian and
Ubuntu will highlight issues for you.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20110425/84ed2784/attachment.asc>


More information about the PLUG mailing list