Re: Version 2.1.70 ms-dos fs strange.

Ian Collier (imc@comlab.ox.ac.uk)
Sun, 7 Dec 1997 20:22:00 +0000 (GMT)


On Sat, 6 Dec 1997 22:29:31 -0500 (EST), Richard B. Johnson said:
> > > ls: /dos/drive_C/*.bak: Invalid argument

> > Apparently what happens is that when no files match the pattern *.bak,
> > ls tries to stat the name '*.bak', which is an invalid filename under
> > DOS.

> But filename.bak or FILENAME.BAK or *.BAK, etc, are not invalid names
> under MS-DOS.

*.bak _is_ an invalid name under MS-DOS. Just try to create it. The
fact that you can "dir *.bak" is because the "dir" command interprets
the asterisk in a special way - as does your shell in Unix.

> The relatively new behavior makes scripts that contain :
> rm -f *.bak
> ... on a MS-DOS file-system fail because rm ignores ENOENT (only) when
> using the (f)orce option. I can modify rm, but this is not the correct
> fix.

The correct fix is to modify the shell so that it has an option
(set -o nullmatch, say) which expands "*.bak" to the empty list when
there are no matching filenames. I could have sworn that such an option
already existed, but I can't find it so I must have been wrong.

imc