Article View: gnu.misc.discuss
Article #62954Avoiding `rm foo *` (Re: Hurd questions)
From: Martin Cracauer
Date: Wed, 29 Mar 1995 00:00
Date: Wed, 29 Mar 1995 00:00
34 lines
1837 bytes
1837 bytes
Stefan 'Stetson' Skoglund <sp2stes1@ida.his.se> writes: >>>>>> "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. We want to avoid that the user does `rm foo *` instead of `rm foo*`, right? Just let rm(1) abort when a filename is twice in the command line and let rm(1) expand '*' by itself, see if all the files are on the command line and abort when both '*' and some other filename in the same directory are supplied. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Private email Martin.Cracauer@wavehh.hanse.de Fax +4940 522 8536. No NeXTMail! "As far as I'm concerned, if something is so complicated that you can't ex- plain it in 10 seconds, then it's probably not worth knowing anyway" - Calvin
Technical Details
Message-ID:
<1995Mar29.110146.4370@wavehh.hanse.de>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: cracauer@wavehh.hanse.de (Martin Cracauer) Subject: Avoiding `rm foo *` (Re: Hurd questions) Date: 1995/03/29 Message-ID: <1995Mar29.110146.4370@wavehh.hanse.de> X-Deja-AN: 100560873 references: <81696@sdcc12.ucsd.edu> <3kpfba$k85@jak.cosy.sbg.ac.at> <SP2STES1.95Mar27110801@sol1.ida.his.se> organization: The Internet newsgroups: gnu.misc.discuss