sed command via SSH not working as expected



Hi,

I am using openssh from Debian Lenny which is version 1:5.1p1-5.

I am using ssh to run a command on a remote host running Debian Lenny as
well.

The line I am editing with sed looks like this:
'(proxyAddresses=*)' 2>$ERRORLOG | $GREP -if $RELAYDOMAINS | $GREP -Fi
smtp \

I am running the following command to update the line as follows:
ssh root@xxxxxxxxxxxxxxxxxx "sed -i 's/$GREP -Fi smtp/$GREP -Fi smtp |
$SORT -u/' /usr/local/bin/script.sh"

But what I find is that the line ends up looking like this on the remote
host:
'(proxyAddresses=*)' 2>$ERRORLOG | $GREP -if $RELAYDOMAINS | $GREP -Fi
smtp | -u \

The important part being "| -u" which should look like "| $SORT -u".

This command works fine when running it on the command line directly.

Could I be missing something or perhaps this is a bug?

Thanks,

James



Relevant Pages

  • Re: Really need help on this one
    ... Is there a way to read the output of a particular command into ... Heres a better example using ssh. ... set timeout $timeout ... exec kill -9 $pid ...
    (comp.lang.tcl)
  • Re: OT: Hard disk mirror with Paragon on USB stick?
    ... at least two pages of intricate command line stuff. ... The password is only used when you want to backup to a remote machine ... via the network, using the ssh protocol. ... (e.g. with linux, ...
    (sci.electronics.design)
  • RE: midnight commander and ssh sftp
    ... midnight commander and ssh sftp ... which is displayed at the bottom of the MC panel. ... "Left file command options right" at the top of the MC ... MC SSH session with the remote host by hitting F10 key. ...
    (freebsd-questions)
  • Re: sshd and ftpd
    ... ssh keys, so when you log in it doesn't ask for one. ... we want to be able to connect to our remote host without ... If you used the defaults supplied by the ssh-keygen command, ...
    (Ubuntu)
  • Re: ssh
    ... With 'fully' I mean that command: ... ssh target_machine_name date ... ~/.ssh/authorized_keys on my home computer. ... He also mentioned scp, and I think the better alternative would be to run sftp with a batch file. ...
    (Debian-User)