Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 May 2006 10:29:13 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        <freebsd-questions@freebsd.org>
Subject:   Re: /bin/sh: wildcard expansion fails
Message-ID:  <44d5ec3eti.fsf@be-well.ilk.org>
In-Reply-To: <000301c67921$941b5a20$01010101@avalon.lan> (nospam@mgedv.net's message of "Tue, 16 May 2006 21:47:34 %2B0200")
References:  <000301c67921$941b5a20$01010101@avalon.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
"No@SPAM@mgEDV.net" <nospam@mgedv.net> writes:

> i know things like "cat *lst|wc", but i don't want to type them.
> when i try to use wildcards with "<" or ">" in /bin/sh, it fails:
>
> my input (only one file with this name exists in the current dir):
> wc <*lst

Which is equivalent to "wc *lst", so I'm not sure why you'd want to do
that... 

> /bin/sh's output:
> cannot open *lst: No such file or directory
>
> is there a way to configure /bin/sh for "more/better" expansion?

No.

Incidentally, it is operating as documented (pathname expansion isn't
listed as performed on redirection targets), and explicitly allowed by
the POSIX standard.

> btw, with csh it works fine ;-)

And some other shells too, I'm sure.  

Feel free to fix this yourself; if it still meets the POSIX standards
(i.e., still errors out if the expansion returns multiple files), the
change would probably be accepted...



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