Re: Ksh output garbled/out-of-sync



On 10 Mai, 11:54, Bill Marcum <marcumb...@xxxxxxxxxxxxx> wrote:
On 9 May 2007 19:20:15 -0700, govindrjuj...@xxxxxxxxx

<govindrjuj...@xxxxxxxxx> wrote:

On May 9, 8:28 pm, govindrjuj...@xxxxxxxxx wrote:
Can somebody explain this ? -- thx

/tmp> cat ./1.sh
#!/bin/ksh

for name in 1 2 3 4 5 6 7 8 9 10
do
/bin/echo "<$name>"
/bin/cat /etc/passwd | head -1 | tail
done

/tmp> ./1.sh
<1>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<2>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<3>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<4>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<5>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<6>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<7>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<8>
<9>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh
<10>
root:x:0:1:HOSTNAME Super-User:/:/usr/bin/ksh

Looks like problem with "head". Happening on Solaris 5.8.

Try adding "wait" before "done". What version of ksh is this?
What happens if you use the builtin echo instead of /bin/echo?

--
Heard that the next Space Shuttle is supposed to carry several Guernsey cows?
It's gonna be the herd shot 'round the world.

And while experimenting; what's the result if you remove all
superfluous processs from

/bin/cat /etc/passwd | head -1 | tail

head -1 </etc/passwd

Does this also produce the disordered output?

Janis

.