Re: ssh command passing
On Fri, Oct 24, 2003 at 11:00:17AM +0100, Rus Foster wrote:
} Hi All,
} I'm sure this is something stupid but I'm running the following command
} and its not working
}
} base-2.05a$ ssh remotehost find /home -name .bash_history -exec grep foo
} {} \;
} find: missing argument to `-exec'
}
} I've tried quoting it, escaping it..What am I doing wrong?
The problem is that the ; is vanishing. Remember that the command goes
through the shell twice (once locally and once remotely). In the local
shell, \; turns into ;. In the remote shell, ; is considered a command
separator. You need to escape both the \ and the ;, i.e. \\\;, to make it
work. When problems like this come up, I recommend using echo to test:
% ssh remotehost echo find /home -name .bash_history -exec grep foo {} \;
find /home -name .bash_history -exec grep foo {}
% ssh remotehost echo find /home -name .bash_history -exec grep foo {} \\\;
find /home -name .bash_history -exec grep foo {} ;
} Rus
--Greg
Reply to: