This is the mail archive of the
mailing list for the Cygwin project.
RE: rm: cannot remove `fil*.txt': No such file or directory
Eric Blake wrote on 08 May 2008 13:15:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> According to mirz on 5/8/2008 6:02 AM:
>> sh-3.2$ rm fil*.txt
>> rm: cannot remove `fil*.txt': No such file or directory
>> When I used * with ls it works correct
>> sh-3.2$ ls fil*
> Why not 'rm fil*' - if ls can use it, then rm can too, because * is
> expanded by the shell, and not by ls or rm.
> In the meantime, you might want to try 'ls -Q fil*' - perhaps the reason
> that 'fil*.txt' fails but 'fil*' works is that the suffix is not truly
> '.txt' but something cruel like '.txt '.
Yes, the error message from rm clearly shows that the glob has failed to
match anything in the current directory, and is trying to delete a filename
that has an actual asterisk in the middle of it.
What's a bit curious is why that glob failed, when the earlier 'touch'
command should have created that exact file, and not anything like '.txt '.
mirz, The thing to try is using autocompletion to see what bash thinks is
matching and at what point it goes wrong.
Type "rm fil*", then press TAB once or twice and ensure that 'file.txt'
shows up. Then try it again with "rm fil*.*", "rm fil*.t*", and rm
"fil*.tx*", finally "rm fil*.txt*" and then "rm fil*.txt". See what happens
at each stage and which one is the first to fail to match.
Oh, also, send us your cygcheck attachment. There's something probably not
quite right in your configuration if you get the "sh" prompt.
Say, you don't have MinGW or MSYS installed as well as Cygwin and are maybe
getting interference between the two, are you?
Can't think of a witty .sigline today....
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html