This question already has an answer here:
- is it possible to use variables in remote ssh command? 2 answers
I have a command that, when I run locally, I use backticks in to get that output of the commands contained within them and I want to send this over ssh (this isn't the actual command but a shortened example)
cat `ls -alr | grep 'someregex'`
I tried using
ssh -f hostname cat `ls | grep 'someregex'`
however this doesn't act as I was expecting and instead executes the backticks locally, does anyone know a way around this?