Problems with rm -f

john.urban urban at cbnewsl.att.com
Wed May 15 22:54:27 AEST 1991


In article <1991May14.190816.17169 at rodan.acs.syr.edu> jstewart at rodan.acs.syr.edu (Ace Stewart) writes:
>
>System: Sun 4/490 running 4.1_PSR_A
>
>Problem: When running a "rm -f" on files that may or may not be in a
>sub-directory, the -f doesn't seem to suppress the error output if a
>file doesn't exist. Script as follows:
>
>----------------
>% ls .Mail/drafts			Listing of directory
>1	2
>3	,1
>,4
>
>% rm -f .Mail/drafts/,*			Remove the , files (temp files)
>%					All okay!  :)
>
>% rm -f .Mail/drafts/,*			Do it again, _problems!_
>No match.
>%
>----------------
>
>What the heck is the -f option there for if it still throws up at you
>if files in a sub-directory don't exist? It works fine if you are _in_
>a that directory (i.e. 'rm -f ,*'  run twice in the sub-directory
>suppresses errors correctly)
>
>Comments/suggestions/help? Am I doing something incredibly stupid?

The 'No match' comes from the csh(1) and not from rm(1).  Try:
% ls -l .Mail/drafts/,*
No match.

%
If you change your shell to the bourne shell (sh) or the korn shell (ksh),
$ ls -l .Mail/drafts/,*  will show:
.Mail/drafts/,*: No such file or directory
$

The rm command is working fine it is the C Shell that is displaying the No match
before rm 'sees' the arguments.


Sincerely,

John Ben Urban



More information about the Comp.unix.questions mailing list