Ssh to remote server loop is breaking | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Ssh to remote server loop is breaking

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-17-2013
raghur77 raghur77 is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 5 April 2014, 12:43 PM EDT
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Linux Ssh to remote server loop is breaking

hi All,

cat login.list

Code:
server1 userid1
server2 userid2
server3 userid3

----------------------------------------


Code:
#SSHSCRIPT.ksh
FILE=login.list
 
while read vah vah_id
do
       ssh  $vah -l $vah_id "pwd"
done < "$FILE"

-----------------------------------------

When i execute ksh -x SSHSCRIPT.ksh it executes only one loop and exist, Please assist me here

OUTPUT:

Code:
 ksh -x SSHSCRIPT.ksh 
 + FILE=login.list
 + read vah vah_id
+ IFS=
+ ssh server1 -l userid1 pwd
/server1/admin
+ read vah vah_id
+ IFS=


Last edited by Franklin52; 01-17-2013 at 04:27 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
    #2  
Old 01-17-2013
Scott's Avatar
Scott Scott is online now Forum Staff  
Administrator
 
Join Date: Jun 2009
Last Activity: 1 October 2014, 8:03 PM EDT
Location: Zürich
Posts: 8,483
Thanks: 332
Thanked 1,047 Times in 914 Posts
This is a fairly common question.

The fairly common answer is to use the -n option of SSH.
Sponsored Links
    #3  
Old 01-17-2013
raghur77 raghur77 is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 5 April 2014, 12:43 PM EDT
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
it worked with -n option.
thank you very much.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
while loop stops after first iteration - remote ssh exit command problem? jelloir Shell Programming and Scripting 3 02-10-2012 12:50 AM
Running for loop on remote server sexyTrojan Shell Programming and Scripting 6 03-14-2010 03:13 AM
SSH Remote Server issue la_womn Shell Programming and Scripting 1 05-20-2008 03:17 PM
automatic ssh into remote server using ksh tekline Shell Programming and Scripting 4 07-23-2007 01:35 PM



All times are GMT -4. The time now is 08:21 PM.