FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

LinkBack Thread Tools
Old 02-01-2012, 08:07 PM
Peter Blajev
Default Bash scripting - Remotely ran commands break while loop

I have two CentOS5 systems server1 and server2. There is user peter on
server1 who can ssh to server2 using public ssh keys and no password is

What I noticed is that running remote ssh commands in bash script breaks
while loops.

for i in server2 server2; do
echo "--> Start"
ssh peter@$i ls
echo "--> END"

echo " server2
server2" |
while read confLine; do
echo "--> $confLine"
ssh peter@$confLine ls
echo "--> END $confLine"

The "for" loop in the script above will run twice but the "while" loop
below it will run only once.

This is very simple to test and I've tried it on different systems
including CentOS6 and OpenSolaris with the same result.

Any idea what would cause the ssh command to break the while loop?

CentOS mailing list

Thread Tools

All times are GMT. The time now is 09:48 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org