[Help-bash] substitution causing issues in ssh to remote host backtick
From:
Rajeev Prasad
Subject:
[Help-bash] substitution causing issues in ssh to remote host backtick
Date:
Fri, 8 Aug 2014 08:26:28 -0700
hello friends,
can someone help understand why 1st is working but second is not?
working:
ssh server10 'for t in `ls /xyz/abc/lmn|grep -v xxx`;do ls /xyz/abc/lmn/$t |
sed -e "s/some/someelse/";done'
not working:
host=server10
folder=/xyz/abc/lmn
ssh $host 'for t in `ls $folder|grep -v xxx`;do ls $folder/$t | sed -e
"s/some/someelse/";done'
it seems substitution inside backtick is causing the failure, but i am not able
to understand why?