GOTCHA in Ubuntu - broken shell

Steven W. Orr steveo at syslang.net
Sat Sep 29 10:00:07 EDT 2007


On Friday, Sep 28th 2007 at 14:53 -0000, quoth Bill Sconce:

=>_______________________________________
=>Another example. This one is [was] my "favorite"; I think it was
=>the first one to bork on me. The error message was [is] so obscure
=>that for the past year I've lived with band-aiding each "if" 
=>statement one at a time, just to have something which works.
=>(One uses "if" statements much more frequently than slicing.)
=>In bash:
=>  $ if [ "${breakfast}" == "spamandeggs" ]; then
=>  >   echo "yummy"
=>  > fi
=>  yummy
=>  $ 
=>In dash:
=>  $ if [ "${breakfast}" == "spamandeggs" ]; then
=>  >   echo "yummy"
=>  > fi
=>  [: 11: ==: unexpected operator
=>  $ 
=>  
=>How ugly and unhelpful is that?  
=>
=>The band-aid, by the way, was that "=" instead of "==" works.
=>(And how ugly is THAT? And how do you explain that to a student?)

FYI, the correct operator is = and == is an extension of bash. == should 
not be used.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


More information about the gnhlug-discuss mailing list