Bash weirdness

Steven W. Orr steveo at syslang.net
Thu Jul 24 14:14:34 EDT 2008


On Thursday, Jul 24th 2008 at 13:00 -0000, quoth Tom Wittbrodt:

=>John Abreau wrote:
=>> I've got a server that's been giving strange errors lately. Most
=>> noticeably, when I login,
=>> I get several errors of the form
=>>
=>>     -bash: [: =: unary operator expected
=>>
=>>
=>>   
=>[snip]
=>> I've tried googling for these symptoms, but so far I haven't found a match.
=>> Has anyone else run across this odd behavior? What could be causing it?
=>>
=>> The server with the broken behavior is running CentOS release 5.2,
=>> and bash is bash-3.2-21.el5.
=>>   
=>
=>Any chance /bin/sh is linked to dash instead of bash?
=>
=>I had the "unary operator expected" errors on Ubuntu 6.06 until I 
=>learned they started linking /bin/sh to dash instead of bash. My CentOS 
=>systems don't seem to have dash at all but it's worth a look.
=>
=>-- Tom

Good call. I ran into this one just yesterday. Things in backquotes are 
not run by bash. They're run by /bin/sh. (I'm not sure how the SHELL 
variable plays here.) Under some Ubuntu systems, if dash is installed then 
you end up with /bin/sh symlinked to /bin/dash. You can use 

dpkg --reconfigure dash

to fix it, or use update-alternatives or galternatives.

-- 
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