Hello Frank

Thank you for your respond.
-K is mks setting for korn shell rather then born shell.

Thank you,
Gene.

On Mar 27, 2013, at 9:52 AM, "Rahoi, Frank" <[email protected]> wrote:

> Likely an MKS bug.  I ran (more or less the same) script under ksh-88 on 
> HPUX, and it worked fine (see below), although I’m not sure what –K is 
> supposed to do.
>  
> $ cat /tmp/fx
> set -K
> SCRDIR=/tmp;
> F1=$SCRDIR/f1
>  
> function func
> {
> #set -x
>  
> INP_SCR=$1
> F2=$SCRDIR/f2
>  
> while read  CUR_OBJ
> do
> print "Cur_Obj: $CUR_OBJ"
> if [ $CUR_OBJ = $INP_SCR ];then
>     print "Found the same"
> fi
> done< $F2
> }
>  
> while read k
> do
>     print "===KKKK===: $k"
>     func "$k"
> done < $F1
>  
>  
> /tmp/fx: -K: bad option(s)
>  
> ===KKKK===: this
> Cur_Obj: more
> Cur_Obj: and
> Cur_Obj: less
> ===KKKK===: and
> Cur_Obj: more
> Cur_Obj: and
> Found the same
> Cur_Obj: less
> ===KKKK===: that
> Cur_Obj: more
> Cur_Obj: and
> Cur_Obj: less
>  
>  
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of gene golub
> Sent: Tuesday, March 26, 2013 9:12 PM
> To: [email protected]
> Subject: [ast-users] Need your advise on loop coding
>  
> Hello Forum,
> 
> I came across of unexpected behavior of while loop reading values from file 
> and calling function which uses while loop to read file as well.
> simple example is below.
> 'while read k' loop should read 3 lines from the file. 
> But instead ... 
> reads only 1st line.
> 
> Can you please help. I show simplified script as an example. I use MKS Tools 
> Korn Shell for windows.
> 
> #set -x
> set -K
> SCRDIR=c:/working/de1/3_26
> 
> F1=$SCRDIR/analyze_scripts1.sh.vie.lst
> 
> function func
> {
> #set -x
> 
> INP_SCR=$1
> F2=$SCRDIR/analyze_scripts1.sh.cur5.lst
> 
> while read  CUR_OBJ
> do
> print "Cur_Obj: $CUR_OBJ"
> if [ $CUR_OBJ = $INP_SCR ];then
>     print "Found the same"
> fi
> done< $F2
> }
> 
> while read k
> do
>     print "===KKKK===: $k"
>     func "$k"
> done < $F1
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to