Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PB in "while read" loop and remsh

Status
Not open for further replies.

jpmur2

Technical User
Nov 27, 2007
2
0
0
FR
Hello,

On HP-UX shell (sh ou ksh), it seems there is a bug in the while loop.

Try :
echo 'serv1
serv2' | while read N
do
echo $N
done
It works fine and prints:
serv1
serv2

Then try :
echo 'serv1
serv2' | while read N
do
echo $N
remsh $N "ls /etc/passwd"
done

It prints only :
serv1
/etc/passwd

Where is serv2 ???

In fact it exits from the while loop after the first line !
Why ? I do not remember the same problem on Aix ...

HP-UX version B.11.11 but I noticed it on another version.

JP

 
This has been asked a few times in Unix scirpting forum:

thread822-1357517
thread822-1347151
thread822-1152123

hope this helps
 
Great !

The option -n works fine.

Thanks a lot.

JP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top