Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!stan!dce From: dce@Solbourne.COM (David Elliott) Newsgroups: comp.unix.questions Subject: Re: sh syntax question Message-ID: <851@marvin.Solbourne.COM> Date: 20 Apr 89 22:19:32 GMT References: <8283@ihlpf.ATT.COM> Reply-To: dce@Solbourne.com (David Elliott) Distribution: usa Organization: Solbourne Computer Inc., Longmont, Colorado Lines: 32 In article <8283@ihlpf.ATT.COM> lukas@ihlpf.UUCP (Lukas,J.) writes: >Can anyone explain why this syntax: > > for file; do > >works fine with ksh, but fails with sh with a message like: > > unexpected ; The likely answer is that sh just wasn't written to handle this case. Either the ksh parser works differently, or someone working with ksh decided that this was a bug and fixed it. I think you'll find that for file do works just fine. >The syntax: > > for file in $@; do > >works fine with both ksh and sh. TIA The term "works fine" is a relative term (high horse time again). If you use $@ and not "$@", it's kind of like wearing a condom made of cheesecloth. -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce