bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoid asterisk expansion when it selects "everything"


From: Stephane Chazelas
Subject: Re: Avoid asterisk expansion when it selects "everything"
Date: Thu, 14 Apr 2016 09:07:30 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2016-04-13 11:23:01 +0000, Anis ELLEUCH:
> Hello everybody,
> 
> I would like to ask if it is possible to disable expanding asterisk when it
> selects all entries ?
> 
> `$ rm * .jpg` with a mistaken space between asterisk and .jpg will delete
> everything in your home directory or in the entire disk.
> 
> In my opinion, when the user asks to select "everything" which could be `*`
> or `path/*`, bash has to show a confirmation prompt to check if the user
> was not mistaken, this option should be obviously disabled by default
> 
> Another idea: `*` and `/*` should not be interpreted and the user has to
> enter another sequence "more powerful" to emphasize selecting all entries (
> `^*` would it work just fine ?)
[...]

zsh does that by default:

$ rm * .jpg
zsh: sure you want to delete all the files in /tmp [yn]?

(disabled with "setopt RM_STAR_SILENT")

Also in tcsh, though not enabled by default there:

> set rmstar
> rm *
Do you really want to delete all files? [n/y]

(they match on "rm *" or "rm dir/*")

For bash, you can try this approach:
https://unix.stackexchange.com/questions/108803/preventing-deletion-of-system-shell-aliased-folders/108854#108854

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]