remote file moves, over SSH, with wildcards ... help needed.

Bill Moran wmoran at collaborativefusion.com
Fri May 26 08:28:58 PDT 2006


Ensel Sharon <user at dhp.com> wrote:

> 
> (FreeBSD 6.0-RELEASE)
> 
> I cannot move a file, over ssh, with wildcards:
> 
> # ssh user at host.com mv /dir/file*.wav /dir2
> ssh: No match.
> 
> Ok, so I quote it:
> 
> # ssh user at host.com mv "/dir/file*.wav" /dir2
> Password:
> mv: rename /dir/file*.wav to /dir2/*.wav: No such file or directory
> 
> I even tried single quoting both paths, and just double quoting the
> file*.wav
> 
> Nothing works.
> 
> Is it possible to move with wildcards over ssh ?

It's definately possible.  Others have provided suggestions -- I've had
success quoting the entire command:

ssh user at host.com "mv /dir/file*.wav /dir2"

ssh is odd, because you first have the local shell trying to interpret
the metacharacters, then you have the remote shell trying to do it.
I've had cases where I had to double escape things, for example:

ssh user at host.com "echo \"cp * /backup\" >> log.txt"

I wrote a whole remote control framework for a client once, and I believe
I had 4 \ at one point in the script.

-- 
Bill Moran

That's why I never kiss 'em on the mouth.

	Jayne Cobb



More information about the freebsd-questions mailing list