ksh doesn't return the exit code of the last command within a pipe

Solution Verified - Updated -

Issue

  • ksh doesn't return the exit code of the last command within a pipe
  • How to reproduce
[root@localhost ~]# rpm -iv ksh-20120801-10.el6.x86_64.rpm
Preparing packages for installation...
ksh-20120801-10.el6
[root@localhost ~]# ksh
# A=`false | true`; echo $?
0
# exit
[root@localhost ~]# rpm -Fv ksh-20120801-10.el6_5.9.x86_64.rpm
Preparing packages for installation...
ksh-20120801-10.el6_5.9
[root@localhost ~]# ksh
# A=`false | true`; echo $?
1

Environment

  • Red Hat Enterprise Linux (RHEL) 6
  • ksh-20120801-10.el6_5.9.x86_64.rpm

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content