I have the following command to remote into a local server and tail -f
the latest log file for an application that I have.
The command works perfectly fine from the command line -
ssh user@hostname 'tail -f $(ls -1r ~/Development/python/twitter-bot/logs/*.log | head -1)'
The problem is that when I make it an alias (or even a function), it evaluates the completion of the ls -1r
on my local machine and tries to pass that to the remote machine.
alias latestbotlogs="ssh user@hostname 'tail -f $(ls -1r ~/Development/python/twitter-bot/logs/*.log | head -1)'"
function latestbotlogs {
ssh user@hostname 'tail -f $(ls -1r ~/Development/python/twitter-bot/logs/*.log | head -1)'
}
What syntax do I need to use such that the entire command gets evaluated on the remote machine that I am accessing via SSH.
Thanks in advance!