LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-04-2004, 10:52 AM   #1
hurny^
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 = 192.168.200.13)

#!/bin/sh
# 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, 03:00 PM   #2
jim mcnamara
Member
 
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:

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


Reply



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 01:22 PM
Error USB-HUC on booting due in mdk10 due to mx700 Boudewijn Mandriva 4 10-09-2004 08:36 AM
Smoothwall SSH Failure extremebfn Linux - Networking 1 08-27-2004 12:38 PM
ssh password failure (sometimes) zergio Linux - Security 9 12-10-2003 08:21 PM
SSH Hangs (not due to DNS problems!) diberri Linux - Software 4 07-22-2003 11:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:50 PM.

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