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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.