How to keep variable preserve while running script through ssh

Posted by Ali Raza on Super User See other posts from Super User or by Ali Raza
Published on 2013-10-25T12:07:45Z Indexed on 2013/10/27 9:59 UTC
Read the original article Hit count: 400

Filed under:
|
|
|

I am trying to run while loop with read through ssh:

#!/bin/bash

ssh [email protected] "cat /var/log/syncer/rm_filesystem.log | while read path; do stat -c \"%Y %n\" "$path"  >> /tmp/fs_10.10.10.10.log done"

But the issue is my variable $path is resolving on my localhost where as I want to resolve it on remote host so that it can read file on remote host and take stat of all folder/files listed in "rm_filesystem.log"

© Super User or respective owner

Related posts about linux

Related posts about bash