Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-03 Thread Marc Deop
On Wednesday 01 February 2012 19:03:33 Peter Blajev wrote: > On Wed, Feb 1, 2012 at 2:53 PM, Stephen Harris wrote: > > > On Wed, Feb 01, 2012 at 01:07:31PM -0800, Peter Blajev wrote: > > > echo " server2 > > > server2" | \ > > > while read confLine; do > > > echo "--> $confLine" > > > s

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Peter Blajev
On Wed, Feb 1, 2012 at 7:13 PM, Stephen Harris wrote: > On Wed, Feb 01, 2012 at 07:03:33PM -0800, Peter Blajev wrote: > > On Wed, Feb 1, 2012 at 2:53 PM, Stephen Harris wrote: > > > > > On Wed, Feb 01, 2012 at 01:07:31PM -0800, Peter Blajev wrote: > > > > echo " server2 > > > > server2" | \ > >

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Stephen Harris
On Wed, Feb 01, 2012 at 07:03:33PM -0800, Peter Blajev wrote: > On Wed, Feb 1, 2012 at 2:53 PM, Stephen Harris wrote: > > > On Wed, Feb 01, 2012 at 01:07:31PM -0800, Peter Blajev wrote: > > > echo " server2 > > > server2" | \ > > > while read confLine; do > > > echo "--> $confLine" > > >

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Peter Blajev
On Wed, Feb 1, 2012 at 2:53 PM, Stephen Harris wrote: > On Wed, Feb 01, 2012 at 01:07:31PM -0800, Peter Blajev wrote: > > echo " server2 > > server2" | \ > > while read confLine; do > > echo "--> $confLine" > > ssh peter@$confLine ls > > echo "--> END $confLine" > > done > > > The

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Stephen Harris
On Wed, Feb 01, 2012 at 01:07:31PM -0800, Peter Blajev wrote: > echo " server2 > server2" | \ > while read confLine; do > echo "--> $confLine" > ssh peter@$confLine ls > echo "--> END $confLine" > done > The "for" loop in the script above will run twice but the "while" loop > below

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Les Mikesell
On Wed, Feb 1, 2012 at 3:46 PM, Alexander Dalloz wrote: > > That has simply nothing to do with SSH. Compare following: > > echo "foo bar" | while read LINE; do echo $LINE; done > > and > > echo -e "foo\nbar" | while read $LINE; do echo $LINE; done No, (a) that read $LINE should be read LINE and (

Re: [CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Alexander Dalloz
Am 01.02.2012 22:07, schrieb Peter Blajev: > 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 > needed. > > What I noticed is that running remote ssh commands in bash script breaks > while loops. > > =

[CentOS] Bash scripting - Remotely ran commands break while loop

2012-02-01 Thread Peter Blajev
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 needed. What I noticed is that running remote ssh commands in bash script breaks while loops. == #!/bin/sh for i in server2 server2; do echo "-->