View Full Version : Executing commands with parameters using a variable over ssh

March 9th, 2009, 06:15 PM
Hi I have a very simple question! Hope you guys can solve this!

$ cmd="/usr/bin/ssh user@host 'ls -l'"
$ $cmd

and I get

bash: ls -l: command not found

I think that bash is executing the command locally but I want it to execute the command on the remote host!

Any help would be very appreciated!!