I'm using the below command in a script:
ssh user@<ip> "ssh user1@<ip1> 'df -k /local/ | awk '{print \$4}' | tail -1'" so it escapes once the special character '$' but it sends the command as below in the second server:
debug1: Sending command: df -k /local/ | awk {print } | tail -1 awk: cmd. line:1: {print awk: cmd. line:1: ^ unexpected newline or end of string can someone help me with a solution?
ssh's ProxyCommand option, so that you can connect "directly" to <ip1> from your local host.