In article <bob-AA757D.15320506022008@[EMAIL PROTECTED]
>,
Robert Peirce <bob@[EMAIL PROTECTED]
> wrote:
> In article <bob-A81B29.15162506022008@[EMAIL PROTECTED]
>,
> Robert Peirce <bob@[EMAIL PROTECTED]
> wrote:
>
> > In sh and ksh, I have used
> >
> > for i in `cat file`
> > do
> > do-something-with-$i
> > done
> >
> > on other systems with no problem. In OS X, this sometimes hangs, but
> > sometimes it doesn't, which is very confusing. Pr also hangs, but for
> > some strange reason, head works in the same script!
> >
> > Does anybody have any idea what I am doing wrong? This should always
> > work fine, but sometimes it doesn't.
>
> Okay. I have more info. There seems to be some sort of buffer
> limitation in for. Perhaps somebody can tell me what it is. The file,
> in the case that hangs, is 1,635,888 lines and 24,538,320 characters.
> Other platforms seem to be able to handle this. OS X is hanging.
This is embarrassing (for OS X), but I ran this script using ksh in Uwin
on a PC and it worked:
for i in $(cat s.p); do print $i; done | head
but it doesn't work in ksh on OS X.
Cat works fine by itself, so the limitation is in the for;do;done loop.
--
Robert B. Peirce, Venetia, PA 724-941-6883
bob AT peirce-family.com [Mac]
rbp AT cooksonpeirce.com [Office]


|