Dixi quod…

>On Wed, 7 Jan 2015, Eduardo A. Bustamante López wrote:

>>   From POSIX, I think the ksh's are wrong in #9 and #10.
>
>> # -   code [ # input ]                               bash  ksh93  mksh  zsh  
>>  bbsh  bsh   dash
>> # 9   IFS=\\ read f; printf %s\\n "$f" # <\>         <>    <\>    <\>   <>   
>>  <>    <>    <>
>> # 10  IFS=\\ read f; printf %s\\n "$f" # <\\>        <\>   <\\>   <\\>  <\>  
>>  <\>   <\>   <\>

>So, I agree the correct output for #9 and #10, respectively, is
>probably '<' '>' and '<' '\\' '>', as in GNU bash and others.

While fixing this, I’m seeing this…

>> # 7   IFS=\\ read f g; printf %s\\n "$g" # <\\>            \>     \>    >    
>>        >

… not longer being true:

$ print -r -- '<\\>' | mksh -c 'IFS=\\ read f g; printf %s\\n "$g"' # before 
fixing
\>
$ print -r -- '<\\>' | mkshx -c 'IFS=\\ read f g; printf %s\\n "$g"' # after 
fixing
>

Looking at the entirety of it, I believe this to also be correct:

• reading with field splitting splits at the first backslash
  ⇒ f='<'
• then it only has one field remaining, so everything else
  is read into one field '\>', which gets the backslash removed
  ⇒ g='>'

Comparison:

$ print -r -- '<xx>' | mksh -c 'IFS=x read f g; printf %s\\n "$g"'
x>

So yes, after field-splitting but before read-without-dash-r
backslash removal, we have '\>', which gets the backslash removed.

Do you think this is correct too?

Thanks,
//mirabilos
-- 
> emacs als auch vi zum Kotzen finde (joe rules) und pine für den einzig
> bedienbaren textmode-mailclient halte (und ich hab sie alle ausprobiert). ;)
Hallooooo, ich bin der Holger ("Hallo Holger!"), und ich bin ebenfalls
... pine-User, und das auch noch gewohnheitsmäßig ("Oooooooohhh").  [aus dasr]

Reply via email to