[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Avoid asterisk expansion when it selects "everything"
From: |
Mike Frysinger |
Subject: |
Re: Avoid asterisk expansion when it selects "everything" |
Date: |
Thu, 14 Apr 2016 00:42:06 -0400 |
On 13 Apr 2016 11:23, Anis ELLEUCH wrote:
> 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 ?)
alternative idea: alias your rm/mv/etc... commands if you're worried
about them. it's not uncommon to do in ~/.bashrc or wherever:
alias rm='rm -i'
then it's safe to `rm * .jpg`. for example:
$ alias rm='rm -i'
$ rm *
rm: remove regular file ‘aaa’? ^C
-mike
signature.asc
Description: Digital signature