Article View: gnu.misc.discuss
Article #62969Re: Hurd questions
From: Chet Ramey
Date: Thu, 30 Mar 1995 00:00
Date: Thu, 30 Mar 1995 00:00
45 lines
1762 bytes
1762 bytes
In article <SP2STES1.95Mar27110801@sol1.ida.his.se>,
Stefan 'Stetson' Skoglund <sp2stes1@ida.his.se> wrote:
>
>>>>>> "Martin" == Martin Michlmayr <tbm@tci002.uibk.ac.at> writes:
>In article <3kpfba$k85@jak.cosy.sbg.ac.at> tbm@tci002.uibk.ac.at (Martin Michlmayr) writes:
>
>>> 12) Will hurd give one a way to ask if you really meant
>>> to say 'rm *'? How about other common stupid mistakes
>>> a unix person might do?
>
>Martin> This would be easy to implement. A few lines of code.
>
>Not that easy.
>Why ??
>You have to decide whom is gonna do this check.
>rm or the shell ??
>the shell does the expansion and forward it to rm as parameters.
>rm will find the list in argv.
>How is rm gonna know argv is the result of a * substitution.
Here's a quick solution that works with bash. This can be made
smarter as desired. It does not work in ksh.
alias rm="set -f; _rm"
_rm()
{
for a
do
case "$a" in
\*) echo -n "rm: remove all? "
read ans
case "$ans" in
y*|Y*) ;;
*) set +f ; return 1;;
esac ;;
*) ;;
esac
done
set +f
command rm "$@"
}
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Chet Ramey, Case Western Reserve University Internet: chet@po.CWRU.Edu
Technical Details
Message-ID:
<3lf7dh$fhq@usenet.INS.CWRU.Edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<81696@sdcc12.ucsd.edu> <3kpfba$k85@jak.cosy.sbg.ac.at> <SP2STES1.95Mar27110801@sol1.ida.his.se>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,ef34758fb4e8c162 X-Google-Attributes: gid1025b4,public From: chet@pooh.INS.CWRU.Edu (Chet Ramey) Subject: Re: Hurd questions Date: 1995/03/30 Message-ID: <3lf7dh$fhq@usenet.INS.CWRU.Edu> X-Deja-AN: 100560869 distribution: world references: <81696@sdcc12.ucsd.edu> <3kpfba$k85@jak.cosy.sbg.ac.at> <SP2STES1.95Mar27110801@sol1.ida.his.se> organization: Case Western Reserve University, Cleveland, Ohio, USA newsgroups: gnu.misc.discuss