I am trying to add a variable on my script like this:
ssh root@$dev 'cat /etc/hosts > /var/tmp/hosts_$dev_$(date +%F)'
But, this does not work, I tried with
/var/tmp/hosts\_$dev\_$(date +%F)'
/var/tmp/hosts_${dev}_$(date +%F)'
Can someone please help me the output will still be no matter what I do.
hosts_2017-06-20
Resolution for future use:
I used single quotes instead of double quotes like this:
ssh root@$dev "cat /etc/hosts > /var/tmp/hosts\_$dev\_$(date +%F)"
devis not defined.$dev. Try to use double quotes instead - stackoverflow.com/questions/6697753/…ssh -o dev=$dev