sh: Don't lose $? when backquoted command ends with semicolon or newline.
An empty simple command was added and overwrote the exit status with 0. This affects `...` but not $(...). Example: v=`false;`; echo $?
This commit is contained in:
parent
6a347d023b
commit
2c090c7168
@ -286,7 +286,8 @@ list(int nlflag, int erflag)
|
||||
tokpushback++;
|
||||
}
|
||||
checkkwd = CHKNL | CHKKWD | CHKALIAS;
|
||||
if (!nlflag && !erflag && tokendlist[peektoken()])
|
||||
if (!nlflag && (erflag ? peektoken() == TEOF :
|
||||
tokendlist[peektoken()]))
|
||||
return ntop;
|
||||
break;
|
||||
case TEOF:
|
||||
|
5
tools/regression/bin/sh/expansion/cmdsubst14.0
Normal file
5
tools/regression/bin/sh/expansion/cmdsubst14.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
! v=`false
|
||||
|
||||
`
|
5
tools/regression/bin/sh/expansion/cmdsubst15.0
Normal file
5
tools/regression/bin/sh/expansion/cmdsubst15.0
Normal file
@ -0,0 +1,5 @@
|
||||
# $FreeBSD$
|
||||
|
||||
! v=`false;
|
||||
|
||||
`
|
Loading…
x
Reference in New Issue
Block a user