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: Anis ELLEUCH
Subject: Re: Avoid asterisk expansion when it selects "everything"
Date: Mon, 25 Apr 2016 20:41:38 +0000

Thanks for all your responses.

I think that bash as a programming language is also an everyday tool. The idea of a strong character that selects all files, is it bad?

Le jeu. 14 avr. 2016 à 09:07, Stephane Chazelas <stephane.chazelas@gmail.com> a écrit :
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
--

Sent from my mobile


reply via email to

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