Mikkel L. Ellertson wrote:
Todd Zullinger wrote:
Phil Meyer wrote:
$ ssh otherhost "uptime | awk '{print \$1}'"
awk: cmd. line:1: {print \}
awk: cmd. line:1: ^ backslash not last character on line
Hmmm, it works for me. I tested against remote hosts running
openssh-4.2p1 and openssh-3.1p1, as well as against a more current FC6
openssh server (4.3p2-19.fc6). Is there something funky about the
shell on 'otherhost' or perhaps the version of awk?
The shell on 'otherhost' should not make a difference. It is the
shell on the host running the ssh command that should be changing
/$1 to $1 before sending to "otherhost'. Now, running just the
awk '{print \$1}' on the local host will fail, generating that type
of message.
Mikkel
Progress! And still a bit of a mystery.
All were correct in that the command does work with bash.
My mistake was tunnel vision ...
It does NOT work with tcsh -- which is what old timers who refuse to be
modernized run. :(
The original request (from my son) was called out from a bash script. I
should have just left the test in the script and all would have been well.
Brain fart (senior moment) on my part, sorry.
But the mystery of: "can be done in tcsh?" remains ...
Thanks all!