Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Sep 2001 16:30:03 +0200 (CEST)
From:      Christian Weisgerber <naddy@mips.inka.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/30392: sh: incorrect value of $? in here-documents
Message-ID:  <200109061430.f86EU3484645@kemoauc.mips.inka.de>

next in thread | raw e-mail | index | archive | help

>Number:         30392
>Category:       bin
>Synopsis:       sh: incorrect value of $? in here-documents
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 06 07:50:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Christian Weisgerber
>Release:        FreeBSD 5.0-CURRENT alpha
>Organization:
>Environment:
System: FreeBSD kemoauc.mips.inka.de 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Sep 3 14:29:29 CEST 2001 naddy@kemoauc.mips.inka.de:/home/obj/usr/src/sys/KEMOAUC alpha

>Description:

In here-documents, sh expands $? to the return value of the current
command rather than that of the previous command.

This behavior differs from that of all other Bourne family shells
I have tested (bash 2.05, ksh93 2001-07-04, pdksh 5.2.14, zsh 4.0.2,
Solaris 7 /usr/bin/sh and /usr/bin/ksh).

I noticed this because it breaks the evaluation of several
(non-critical) tests in the configure script of gtar 1.13.22.

>How-To-Repeat:

------->
false
cat >>foo <<EOF
$?
EOF
cat foo
<-------

Returns 0 for FreeBSD sh, 1 for all other shells.

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109061430.f86EU3484645>