I'm running zsh from Cygwin. One of my shell functions contains a statement
rm -f somedir/*
(I want to remove all non-hidden files in somedir, but not the directory itself). However, I am always asked:
zsh: sure you want to delete all the files in ... [yn]?
The wording of this message (note the "zsh:" at the beginning) suggests that the question comes from zsh, not rm. However, rm is an external command:
$ type rm rm is /usr/bin/rm
By the way, the prompt also occurs if I explicitly invoke rm as
$ command rm -f somedir/*
Is there something within zsh, which tries to be too clever?
Use the rm command to remove files you no longer need. The rm command removes the entries for a specified file, group of files, or certain select files from a list within a directory.
Does rm delete a file? The rm command does not delete a file. Instead it unlinks it meaning the data is still on disk but the link to it is removed.
It seems that the RM_STAR_SILENT
is NOT in effect.
You could do setopt rmstarsilent
either in the command line or in ~/.zshrc to tell zsh to not confirm a rm *
.
The shell option RM_STAR_SILENT
is:
Do not query the user before executing
rm *
orrm path/*
.--
zshoptions(1): RM_STAR_SILENT
If you want to make the setopt
effect temporally just in that shell function only, you could use it in conjunction with the localoptions
like below:
my-test () { setopt localoptions rmstarsilent ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With