Subject: Re: [ast-users] A rather unexpected behaviour of typeset -L
--------
> #!/bin/ksh
> KEY="AAAAAA"
> typeset -L3 DISP=$KEY
> print "$DISP;"
> KEY="BBBBBB"
> typeset -L6 DISP=$KEY
> print "$DISP;"
>
> its output is:
>
> AAA;
> BBB ;
>
> which looks rather surprising to me. It seems that typeset first assigns a
> value to a variable and then changes its attributes. I believe this is a
> difference between ksh88 and ksh93 (ksh88 would output 'BBBBBB;' on the
> second line), can you please confirm this? If yes, should this be
> documented (e.g., in the COMPATIBILTY document)? Or is it a bug?
>
> Thanks in advance for the answers,
>
ksh93 treats
typeset [options] name=value ...
as
name=value... typeset name ...
so that arguments to typeset are evaluated as assignments. Thus,
tilde expansion occurs and file name generation and splitting do not.
However, since this causes an undocumented differece between ksh88,
and also because it does seem to be a surprising result, I am
treating this as a bug and I will fixed it for the next update.
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users