Ksh regression on function return

Solution Verified - Updated -

Issue

  • There is a regression with the following Korn Shell code:
#!/bin/ksh

g(){
cat << EOF
$(ls /etc |xargs -i echo "       {}")
EOF
}

for file in $(g)
do
echo $file
done
  • The above should return the list of files under /etc. This used to work on RHEL 5.6 but does not work on RHEL 5.9. Also RHEL 6.3and 6.4 seem to be affected.

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

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