Soham
1
Hi all,
I have observed that ssh exits while loop.
#!/bin/ksh
typeset -i i
typeset -i size
set -A server = " " "SERVER1" "SERVER2"
i=2
while [[ $i -le 3 ]]
do
while read in_module
do
print $in_module
size=`ssh ${server[$i]} ls -l $in_module 2>/dev/null | awk '{print $5}'`
done < file1
(( i=i+1 ))
done
The input file is
cat file1
RX.DBL
RX1.DBL
The output is
RX.DBL
RX.DBL
If I remove the ssh statement the output is fine. Any help?
TRy waiting:
while [[ $i -le 3 ]]
do
while read in_module
do
print $in_module
size=`ssh ${server[$i]} ls -l $in_module 2>/dev/null | awk '{print $5}'`
wait
done < file1
(( i=i+1 ))
done
wait? Will not help.
The problem is that ssh sucks from the input, here file1
.
The simple solution is
ssh -n ...
or </dev/null ssh ...
3 Likes
Soham
4
Great. Works perfect. Thank you very much.
system
Automatically bumped
5
Moderator comments were removed during original forum migration.