Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2006 11:28:55 -0400
From:      Bill Moran <wmoran@collaborativefusion.com>
To:        Ensel Sharon <user@dhp.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: remote file moves, over SSH, with wildcards ... help needed.
Message-ID:  <20060526112855.32558667.wmoran@collaborativefusion.com>
In-Reply-To: <Pine.LNX.4.21.0605261043440.24656-100000@shell.dhp.com>
References:  <Pine.LNX.4.21.0605261043440.24656-100000@shell.dhp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ensel Sharon <user@dhp.com> wrote:

> 
> (FreeBSD 6.0-RELEASE)
> 
> I cannot move a file, over ssh, with wildcards:
> 
> # ssh user@host.com mv /dir/file*.wav /dir2
> ssh: No match.
> 
> Ok, so I quote it:
> 
> # ssh user@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@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@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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060526112855.32558667.wmoran>