Hi
I am trying to return more than one result from a ssh command.
[root@server ~]# cmd=`for i in 1 2 3; do find /root/dir$i -type f | wc -l; done`
[root@server ~]# echo $cmd
27 5 8
[root@server ~]# cmd=`ssh 192.168.0.1 "for i in 1 2 3; do find /root/dir$i -type f | wc -l; done"`
root@192.168.0.1's password:
[root@server ~]# echo $cmd
8 8 8
I can solve it like this but I'd rather do it all in one connection:
[root@server ~]# cmd=`for i in 1 2 3; do ssh 192.168.0.1 "find /root/dir$i -type f | wc -l"; done`
root@192.168.0.1's password:
root@192.168.0.1's password:
root@192.168.0.1's password:
[root@server ~]# echo $cmd
27 5 8
Thanks
I am trying to return more than one result from a ssh command.
[root@server ~]# cmd=`for i in 1 2 3; do find /root/dir$i -type f | wc -l; done`
[root@server ~]# echo $cmd
27 5 8
[root@server ~]# cmd=`ssh 192.168.0.1 "for i in 1 2 3; do find /root/dir$i -type f | wc -l; done"`
root@192.168.0.1's password:
[root@server ~]# echo $cmd
8 8 8
I can solve it like this but I'd rather do it all in one connection:
[root@server ~]# cmd=`for i in 1 2 3; do ssh 192.168.0.1 "find /root/dir$i -type f | wc -l"; done`
root@192.168.0.1's password:
root@192.168.0.1's password:
root@192.168.0.1's password:
[root@server ~]# echo $cmd
27 5 8
Thanks