gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] shell globbing (was Re: Beginner help request)


From: Adam Spiers
Subject: Re: [Gnu-arch-users] shell globbing (was Re: Beginner help request)
Date: Sun, 11 Jan 2004 20:14:11 +0000
User-agent: Mutt/1.4.1i

Florian Weimer (address@hidden) wrote:
> Adam Spiers wrote:
> >     pdksh% echo *.nothere
> >     *.nothere
> >     pdksh% echo $?
> >     0
> > 
> > Broken and apparently unfixable.
> 
> It's not broken, it's just surprising (to you).

I was never surprised by it.

> POSIX requires this behavior:
> 
> | If the pattern contains an invalid bracket expression or does not match
> | any existing filenames or pathnames, the pattern string shall be left
> | unchanged.

I stand by my assertion that it's broken, and hence that POSIX is
broken too.  Of course there's an implicit "IMHO" here, but not so "H"
given than my "O" is apparently shared by Tom ;-)

As he already pointed out, leaving the pattern string unchanged
follows the principle of most surprise, which is a Bad Thing.  If the
expansion is undesired (such as in the rsync/scp example), then it can
be prevented deterministically via quoting.  If it is desired, then
something sensible should happen when there is nothing to expand to -
either expand to the empty string or raise an exception.  Can you
think of any practical real world example where either of these
behaviours would be less desirable than the POSIX behaviour?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]