Unix questions - FreeBSD ssh with wildcards

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > January 2006 > FreeBSD ssh with wildcards





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FreeBSD ssh with wildcards
Dave Ranney

2006-01-06, 2:59 am

Hi,

I'm on FreeBSD 4.3 and I'm running into what seems like strange behavior
with ssh.

When I do

ssh remotemachine ls /path/to/dir

it returns a list of .html files as I expect.

When I do

ssh remotemachine ls /path/to/dir/*.html

it says

ls: /path/to/dir/*.html: No such file or directory

When I run it with the -v flag I see the command being sent properly
with no forced command.

I tried escaping the * just in case it was trying to expand locally, but
that didn't help.


Any idea what's going on? Am I missing something obvious?

Thanks,
Dave
Michael Tosch

2006-01-06, 5:57 pm

Dave Ranney wrote:
> Hi,
>
> I'm on FreeBSD 4.3 and I'm running into what seems like strange behavior
> with ssh.
>
> When I do
>
> ssh remotemachine ls /path/to/dir
>
> it returns a list of .html files as I expect.
>
> When I do
>
> ssh remotemachine ls /path/to/dir/*.html
>
> it says
>
> ls: /path/to/dir/*.html: No such file or directory
>
> When I run it with the -v flag I see the command being sent properly
> with no forced command.
>
> I tried escaping the * just in case it was trying to expand locally, but
> that didn't help.
>

It normally does and \* should work.
Or
ssh remotemachine "ls /path/to/dir/*.html"
which is better readable IMHO.

The error message indicates that the remote machine's login shell is CSH.
Perhaps noglob is set, and you must do

ssh remotemachine "unset noglob; ls /path/to/dir/*.html"

--
Michael Tosch @ hp : com
Dave Ranney

2006-01-07, 5:57 pm

Michael Tosch wrote:
> Dave Ranney wrote:
>
> It normally does and \* should work.
> Or
> ssh remotemachine "ls /path/to/dir/*.html"
> which is better readable IMHO.
>
> The error message indicates that the remote machine's login shell is CSH.
> Perhaps noglob is set, and you must do
>
> ssh remotemachine "unset noglob; ls /path/to/dir/*.html"


Your suggestion led me to the problem. The shell for the user on the
remote machine wasn't csh but rather a proprietary limited shell which
wasn't globbing.

Thanks for the help. I thought I was going crazy.

- Dave
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com