Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-04-2004, 11:52 AM   #1
LQ Newbie
Registered: May 2004
Posts: 1

Rep: Reputation: 0
Unhappy while loop failure due to ssh

I am having trouble writing a ssh command within a while statement. The while statement is correct, but the use of ssh within it causes the loop to end prematurely.
Here is the code at present. Does anyone have any idea of the solution
p.s. hostmach.dat is a file listing all ip addresses on the LAN (i.e. each line =

# tcode 4/05/2004 13:27:42 4-05-2004 15:38:13
echo "start of file" > temp.dat
while read line
do ssh $line "assign/nodeip" >> temp.dat;
done < "hostmach.dat"
Old 05-04-2004, 04:00 PM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
I think ssh invokes exec - this means you can't get back to the calling shell unless you go to a subprocess to run ssh.
As I remember something like this:

while read line 
       (ssh $line "assign/nodeip" >> temp.dat)
done < "hostmach.dat"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
boot failure due to insufficient space ?? samik Fedora - Installation 3 07-27-2005 02:22 PM
Error USB-HUC on booting due in mdk10 due to mx700 Boudewijn Mandriva 4 10-09-2004 09:36 AM
Smoothwall SSH Failure extremebfn Linux - Networking 1 08-27-2004 01:38 PM
ssh password failure (sometimes) zergio Linux - Security 9 12-10-2003 09:21 PM
SSH Hangs (not due to DNS problems!) diberri Linux - Software 4 07-22-2003 12:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration