in reply to Re: writing portable file processing scripts that use wildcards in filenames
in thread writing portable file processing scripts that use wildcards in filenames
There's no harm in calling glob() on a filename with no wildcards.Indeed, there isn't.
Just glob all but the last argument.No, that would be wrong. Just because globbing on a filename without wildcars is ok doesn't mean that the result of a glob gives you a fixed point.
Suppose for instance you have a utility that removes those files that are given as argument (like rm does). Let's call it remove. But, unlike rm, it globs its arguments - even when working in an environment that globs. Suppose you have a directory that contains the following files:
And you want to remove that pesky file named [a-z]*. You call your program like this:thesis_worked_on_for_the_past_four_years naked_perl_chicks.tar.gz parrot_1.0.0.tar.gz [a-z]*
If you had called rm, the first three files would still be there, with the pesky file removed. However, remove, globbing its arguments, will remove the first three files, leaving the pesky file where it is.remove *a-z*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: writing portable file processing scripts that use placeholders in filenames
by halley (Prior) on Dec 02, 2005 at 13:42 UTC |