[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: Avoid asterisk expansion when it selects "everything"
From:       Anis ELLEUCH <vadmeste () gmail ! com>
Date:       2016-04-25 20:41:38
Message-ID: CAFZij+VXGW-4chw0Xrp_gonf9NN49SRUcdywFO0qLaech_JOaA () mail ! gmail ! com
[Download RAW message or body]

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


[Attachment #3 (text/html)]

<div dir="ltr">Thanks for all your responses.<div><br></div><div>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?<br><br></div><div dir="ltr"><div dir="ltr"><div \
class="gmail_quote"><div dir="ltr">Le  jeu. 14 avr. 2016 Ã   09:07, Stephane Chazelas \
&lt;<a href="mailto:stephane.chazelas@gmail.com" \
target="_blank">stephane.chazelas@gmail.com</a>&gt; a écrit  :<br></div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">2016-04-13 11:23:01 +0000, Anis ELLEUCH:<br> &gt; Hello \
everybody,<br> &gt;<br>
&gt; I would like to ask if it is possible to disable expanding asterisk when it<br>
&gt; selects all entries ?<br>
&gt;<br>
&gt; `$ rm * .jpg` with a mistaken space between asterisk and .jpg will delete<br>
&gt; everything in your home directory or in the entire disk.<br>
&gt;<br>
&gt; In my opinion, when the user asks to select &quot;everything&quot; which could \
be `*`<br> &gt; or `path/*`, bash has to show a confirmation prompt to check if the \
user<br> &gt; was not mistaken, this option should be obviously disabled by \
default<br> &gt;<br>
&gt; Another idea: `*` and `/*` should not be interpreted and the user has to<br>
&gt; enter another sequence &quot;more powerful&quot; to emphasize selecting all \
entries (<br> &gt; `^*` would it work just fine ?)<br>
[...]<br>
<br>
zsh does that by default:<br>
<br>
$ rm * .jpg<br>
zsh: sure you want to delete all the files in /tmp [yn]?<br>
<br>
(disabled with &quot;setopt RM_STAR_SILENT&quot;)<br>
<br>
Also in tcsh, though not enabled by default there:<br>
<br>
&gt; set rmstar<br>
&gt; rm *<br>
Do you really want to delete all files? [n/y]<br>
<br>
(they match on &quot;rm *&quot; or &quot;rm dir/*&quot;)<br>
<br>
For bash, you can try this approach:<br>
<a href="https://unix.stackexchange.com/questions/108803/preventing-deletion-of-system-shell-aliased-folders/108854#108854" \
rel="noreferrer" target="_blank">https://unix.stackexchange.com/questions/108803/preventing-deletion-of-system-shell-aliased-folders/108854#108854</a><br>
 <br>
--<br>
Stephane<br>
</blockquote></div></div></div></div><div dir="ltr">-- <br></div><div dir="ltr"><p \
dir="ltr">Sent from my mobile</p> </div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic