I run a command to fetch server uptime as below
[root@localhosts ~]# printf "`uname -n` `uptime| awk -F " " {'print $3,$4'}`\n"
localhosts 75 days,
Now when I run same command from another hosts to same above linux server "localhosts" to get same output, I get error
[root@master /]# ssh localhosts 'printf "`uname -n` `uptime| awk -F " " {'print $3,$4'}`\n"'
awk: cmd. line:1: {print
awk: cmd. line:1: ^ unexpected newline or end of string
Do you know better way to run the command from another hosts to get similar output from the remote hosts as well?