develooper Front page | perl.perl5.porters | Postings from August 2001

Re: On "Command-line Wildcard Expansion"

Thread Previous | Thread Next
Tye McQueen
August 7, 2001 13:16
Re: On "Command-line Wildcard Expansion"
Message ID:
Excerpts from the mail message of Jenda Krynicky:
) Well that realy depends. Imagine you have a script that is supposed 
) to process a list of files and you call it like this :
) c:\some\dir\> *.txt *.html
) Now if there are some TXT files but no HTML the script will get 
) something like
) @ARGV = ('one.txt', 'two.txt', '*.html');
) and will most probably report that it can't open a file named
) '*.html'. I as a user would be quite surprised by such a message.

Then your users shouldn't use Unix either:

    tye@unix-$ echo *.px
    tye@unix-$ ls *.px
    *.px not found
    tye@unix-$ cat *.px
    cat: cannot open *.px: No such file or directory

Some shells have a separate error message for "*.px" not matching
(and also have an option to disable that to be compatible with the
"default"/"historical" shell behavior).  I can see advantages to
both choices.

Two advantages of the "keep the glob and let the open fail" method
are that it works better when faced with a lack of a well-defined
don't-glob quoting scheme (which Win32 lacks) and it eases backward
compatability in this case.  So I'd go with that as the default in
this specific case.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About