while read, is not looping with ssh.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting while read, is not looping with ssh.
# 1  
Old 09-03-2010
while read, is not looping with ssh.

echo will print all the lines, ssh will not. see below. why is this.

Code:
[root@localhost script]# awk -F: '{print $1,$2,$3}' vfiler_volumes.list | while read filer vfiler vol ; do echo $filer $vfiler $vol ; done
node1 vfiler0 /
node1 vfiler2 /vol/vfiler2_vol0
node1 vfilert /vol/vfiler_vol
node1 vfilert /vol/virt_vol


[root@localhost script]# awk -F: '{print $1,$2,$3}' vfiler_volumes.list | while read filer vfiler vol ; do ssh $filer vfiler run $vfiler df -h $vol ; done

===== vfiler0
Filesystem               total       used      avail capacity  Mounted on
/vol/vol0/               241MB      106MB      135MB      44%  /vol/vol0/
/vol/vol0/.snapshot        0MB       16MB        0MB     ---%  /vol/vol0/.snapshot
[root@localhost script]#

# 2  
Old 09-03-2010
Hi.

Try using ssh -n.
# 3  
Old 09-03-2010
perfect thanx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read several variables from command output via SSH

Hi Folks, I'm currently trying to read several values into different variables. Actually, what I'm doing works, but I get an error message. My attempts are: read strCPROC strIPROC strAPROC <<<$(ssh -n -T hscroot@$HMC "lshwres -r proc -m $strIDENT --level sys -F \"configurable_sys_proc_units... (11 Replies)
Discussion started by: NKaede
11 Replies

2. UNIX for Beginners Questions & Answers

Why this script is not working as 'expected' when doing ssh with while read ... really confused?

Hi, I have a script below that is running ssh <host> <command> on some servers. Below is more or less the script. I have to modify it somehow to get rid of the 'confidential' hostnames check_log.bash #!/bin/bash # myPID=$$ parse_log () { sub="parse_log" host=${1} ... (2 Replies)
Discussion started by: newbie_01
2 Replies

3. Shell Programming and Scripting

Read the USER Quota in SSH

How the User Quota query from an SSH access to Linux Shell. (5 Replies)
Discussion started by: Linuxmann
5 Replies

4. Shell Programming and Scripting

Using read for input over ssh

Hi, I'm using read in a script to prompt and receive input. read -r -p "Do you also want to deploy folder? " response This works fine, however, if I remotely execute the same script via ssh, at this point in the code, I don't see the message at all, but it waits for input. I could echo... (1 Reply)
Discussion started by: say170
1 Replies

5. Shell Programming and Scripting

While read line via ssh

Hi I have a question, Why below script does't work ?: #!/bin/bash cd /home/weblogic/ cp_date=`awk -F '/' '{print "/" $8 "/" $9 "/" $10}' file_ftp.txt` ssh node8@192.168.1.8 'while read line; do ls -l "$line"; done <<< "$cp_date"' >> lsl.txt When I am running this script localy... (2 Replies)
Discussion started by: primo102
2 Replies

6. Shell Programming and Scripting

[Solved] Not able to read the next line from a file after doing ssh

Hi, I am trying to write a code, where it reads the jobnames from a file and checks for the logs in the server. If the log is not found in the first server, then it will ssh to the 2nd server and get the details from there. I will need to save the date in a variable. But the problem is that,... (0 Replies)
Discussion started by: ajayakunuri
0 Replies

7. Fedora

ssh command to read server resources

what is the ssh command to read my server resources, like system operator, Ram installed, CPU etc....? (12 Replies)
Discussion started by: dan8354544
12 Replies

8. Shell Programming and Scripting

read line and ssh

Hi, I 'd like have a script to ssh to a list of hosts from a file name hosts_list. However, the script seem to exit out from the first line of the file #!/bin/bash X="hosts_list"; while read LINE do echo $LINE ssh $LINE hostname done < $X hosts_list file content: linux1 linux2... (3 Replies)
Discussion started by: phamp008
3 Replies

9. Shell Programming and Scripting

Cannot read variables after ssh with rc file (KSH)

Greetings all, I'm currently making use of the $HOME/.ssh/rc file to launch an automated shell script immediately after the user has been verified through ssh. The current problem that I'm facing now is that I am unable to use the "read" command anymore... seems like the "read" statements are... (0 Replies)
Discussion started by: rockysfr
0 Replies

10. Shell Programming and Scripting

looping a array inside inside ssh is not working, pls help

set -A arr a1 a2 a3 a4 # START ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS integer j=0 for loop in ${arr} do printf "array - ${arr}\n" (( j = j + 1 )) j=`expr j+1` done EOS # END ========= this is not giving me correct output. I... (5 Replies)
Discussion started by: reldb
5 Replies
Login or Register to Ask a Question