Bug 20097 - ksh bug in script
Summary: ksh bug in script
Status: CLOSED DUPLICATE of bug 8894
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: pdksh   
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-31 14:22 UTC by Need Real Name
Modified: 2018-07-27 14:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-10-31 14:22:22 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Need Real Name 2000-10-31 14:22:19 UTC
Simply try the following script:
--------------
#!/bin/ksh
typeset a=1
function x {
a=7
}
echo "a) $a"
x | read line
echo "b) $a"
x
echo "c) $a"
--------------
The result is
a) 1
b) 1
c) 7

while I expected
a) 1
b) 7
c) 7

Also according to the manual page of the ksh:
       Compound commands are created using the following reserved
       words  --  these	 words	are  only  recognized if they are
       unquoted and if they are used as the first word of a  com-
       mand  (i.e.,  they  can't be preceded by parameter assign-
       ments or redirections):
		  case	 else	function   then	   !
		  do	 esac	if	   time	   [[
		  done	 fi	in	   until   {
		  elif	 for	select	   while   }
       Note: Some shells  (but	not  this  one)	 execute  control
       structure commands in a subshell when one or more of their
       file  descriptors  are  redirected,  so	any   environment
       changes	inside	them  may fail.	 To be portable, the exec
       statement should be used instead to redirect file descrip-
       tors before the control structure.

Comment 1 Trond Eivind Glomsrxd 2000-10-31 17:52:43 UTC

*** This bug has been marked as a duplicate of 8894 ***

Comment 2 openshift-github-bot 2018-07-27 14:11:55 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/b1f47bfa11c1d9d7bfd20c787f181b3a9b57ca83
Merge pull request #20412 from soltysh/issue20097

Restore -v in set deploymenthook and status


Note You need to log in before you can comment on or make changes to this bug.