delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/06/09:46:23

Date: Fri, 6 Mar 1998 08:49:49 -0600
From: jeffw AT darwin DOT sfbr DOT org (Jeff T. Williams)
Message-Id: <199803061449.IAA07772@kendall.>
To: djgpp AT delorie DOT com
Subject: true and false in bash scripts
Cc: jeffw AT darwin DOT sfbr DOT org

Hello,

I ran into the following problem using `true' and `false'
in a bash script.  When I execute the following script:

#!/djgpp/bin/bash
if true ; then
echo True
else
echo False
fi

I get the following error:

Exiting due to signal SIGSEGV
Page fault at eip=0000a1ba, error=0004
eax=00181700 ebx=001817e0 ecx=ffffffff edx=00000000 esi=00000000 edi=00000000
ebp=0016b440 esp=0016b42c program=/djgpp/bin/bash.exe
cs: sel=0127  base=10220000  limit=0018ffff
ds: sel=012f  base=10220000  limit=0018ffff
es: sel=012f  base=10220000  limit=0018ffff
fs: sel=013f  base=00000000  limit=ffffffff
gs: sel=013f  base=00000000  limit=ffffffff
ss: sel=012f  base=10220000  limit=0018ffff

Call frame traceback EIPs:
  0x0000a1ba
  0x0000e55c
  0x0000e6cf
  0x0000e30e
  0x0000d9b5
  0x0000c6cb
  0x0000bd9d
  0x0000d6be
  0x0000c653
  0x0000bd9d
  0x000027b8

The same thing happens if I enter `true --version' or `true --help',
at the bash prompt, except that bash will then exit and return me
to the DOS prompt.  Otherwise my DJGPP setup has been working just
fine for months.

Can anyone explain this behavior?  The script works fine on my PC with
any other test condition, e.g., `if [ S = S ]' or `if [ 4 -le 2 ]'.
The script also works as written (with `true' and `false') on my Unix
system at work.

TIA
jeff williams
jeffw AT darwin DOT sfbr DOT org

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019