Annoying truths about bash

Annoying truths about bash

Ira Abramov Lists-Linux-IL at ira.abramov.org
Mon Jul 24 19:57:54 IDT 2017


Howdie, here's an anomally I just discovered after a very annoying
debugging session...

My native bash (Ubuntu 17.04) is version 4.4.7(1)-release

# aa=" hello" ; md5sum <<< $aa
fc22c4f0ac67cb377dd50629601e4df0  -
# aa=" hello" ; md5sum <<< "$aa"
fc22c4f0ac67cb377dd50629601e4df0  -

bash on Ubuntu 16.04 has version 4.3.48(1)-release

# aa=" hello" ; md5sum <<< $aa
b1946ac92492d2347c6235b4d2611184  -
# aa=" hello" ; md5sum <<< "$aa"
fc22c4f0ac67cb377dd50629601e4df0  -

So as usual, please give strings explicit quotes, or it will bite you in the tush.

For the record, the way the older bash behaves may well be the "correct"
one (losing the space from the string while tokenizing), and the new one
is more sensible. but it certainly isn't fair to fix this in a minor
version and screw up people's scripts, eh? :)

-- 
Does the name Pavlov ring a bell?
Ira Abramov
http://ira.abramov.org/email/



More information about the Linux-il mailing list