[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash incompatible with sh,maybe this is a bug
From: |
showrun . lee |
Subject: |
bash incompatible with sh,maybe this is a bug |
Date: |
Tue, 25 Dec 2007 11:57:17 +0800 |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: freebsd6.2
Compiler: cc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='
freebsd6.2' -DCONF_MACHTYPE='i386-portbld-freebsd6.2' -D
CONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-I/usr/local/include -O2 -fno-strict-aliasing -pipe
uname output: FreeBSD log1.ops.lfc.qihoo.net 6.2-RELEASE FreeBSD
6.2-RELEASE#0: Thu Dec 6 15:15:26 CST 2007
root@log1.ops.lfc.
qihoo.net:/usr/obj/usr/src/sys/GENERIC i386
Machine Type: i386-portbld-freebsd6.2
Bash Version: 3.1
Patch Level: 17
Release Status: release
Description:
for example,I have a shell script test.sh
#############cat test.sh
test="mama";
test1="";
echo "test is $test";
[ ! "$test" -a "$test1" ] && test="papa";
echo "test is $test";
###########script end
if i use sh,the result which is I wanted,is :
root@dns1# sh test1.sh
test is mama
test is mama
if i use bash, the result is :
root@dns1# bash test1.sh
test is mama
test is papa
I think ,this is a bug in bash.and i test it on many freebsd release 4.11,
6.1,6.2 with default bash version,this is same.
- bash incompatible with sh,maybe this is a bug,
showrun . lee <=