string comparison bug of bash on Ubuntu 9.04 i386

trulyliu trulyliu at gmail.com
Sat Aug 22 03:30:12 BST 2009


qingchengl at T61:/tmp$ cat /etc/issue
Ubuntu 9.04 \n \l

qingchengl at T61:/tmp$ uname -a
Linux T61 2.6.28-15-generic #48-Ubuntu SMP Wed Jul 29 08:54:56 UTC 2009 i686
GNU/Linux
qingchengl at T61:/tmp$ bash --version
GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.


qingchengl at T61:/tmp$ cat run.sh
#!/bin/bash

echo "Input filename: $1"

BOUNDARY='-----------------------------=.3943144700514'

if [ ! -f $1 ]; then
echo "File $1 doesn't exist"
fi

echo "${BOUNDARY}"

while read line
do
 echo "${line}"
# this string comparison never return true, I have tried double bracket and
double =
# This script  run normally on Debian 4.01
 if [ "${line}" = "${BOUNDARY}" ]; then
echo "found start boundary"
fi

done < $1


qingchengl at T61:/tmp$  cat ipfile
-----------------------------=.3943144700511
-----------------------------=.3943144700512
-----------------------------=.3943144700513
-----------------------------=.3943144700514

qingchengl at T61:/tmp$  ./extract.sh ./ipfile
Input filename: ./ipfile
-----------------------------=.3943144700514
-----------------------------=.3943144700511
-----------------------------=.3943144700512
-----------------------------=.3943144700513
-----------------------------=.3943144700514




-- 
trulyliu at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-bugsquad/attachments/20090822/26dea2c1/attachment-0002.htm 


More information about the Ubuntu-bugsquad mailing list