sh syntax question

David Elliott dce at Solbourne.COM
Fri Apr 21 08:19:32 AEST 1989


In article <8283 at ihlpf.ATT.COM> lukas at 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 at Solbourne.COM
			...!{boulder,nbires,sun}!stan!dce



More information about the Comp.unix.questions mailing list