:: [DNG] Living Dangerously (was: Revi…
Top Pagina
Delete this message
Reply to this message
Auteur: g4sra
Datum:  
Aan: dng@lists.dyne.org
Onderwerp: [DNG] Living Dangerously (was: Review of documentation needed)
> g4sra via Dng wrote:
>


> > I opt to live dangerously..(shove an '-r' in there too if you feel like it)
> > $ rm -i .* *
> > this way you can delete illegitimate entries without hacking the filesystem.
>


> That is definitely dangerous indeed.

I wasn't exaggerating, what is life without a little excitement occasionally.
A rookie sysadmin mistake is to take backups but never ever do a test restore to ensure they are OK.
Using this command may provide you with that opportunity to perform a real restore from backup :)

> For example if for whatever
> reason one happens to have "-f" as a file name then it will override
> the "-i" listed as a command line option and then all files will be
> deleted without question.
>


> $ mkdir /tmp/testdir
> $ cd /tmp/testdir
> $ touch ./-f .foo foo
> $ echo rm -i .* *
> rm -i . .. .foo -f foo
> $ rm -i .* *
> rm: cannot remove '.': Is a directory
> rm: cannot remove '..': Is a directory
> $ ll -a
> -rw-rw-r-- 1 rwp rwp 0 Sep 22 14:57 -f
> drwxrwxr-x 2 rwp rwp 60 Sep 22 14:57 ./
> drwxrwxrwt 11 root root 760 Sep 22 14:57 ../
>


> Where is .foo? Where is foo? There was no -i prompt. The -f file i
> still on disk and not removed? All correct behavior given the
> command as given.
>


> When dealing with file globs like "" it is always better to prefix it
> with "./" as in "./" so as to avoid the first character having any
> possibility of matching a dash and being interpreted as an option.


Thanks Bob, I will ensure I use ./* in future :)

> You make your own luck! :-)

I disagree with that though...it should be "You make your own bad fortune"

> [[ I have seen people intentionally leave a -i file in their home
> directory so as to intentionally have rm * cause it to be interpreted
> as an option. I recommend not relying upon it though. ]]

I have seen a few pranks in my time but never came across that one.
The most annoying of which was on one particular academic system which would not let you complete your login until you had read all your new mail.
Some bright spark emailed everybody (including the sysadmin so he could not purge mail) a copy of the system spellchecker dictionary.

I doubt the following will ever be topped, also a fashion statement, if you know different please post to this new thread.
https://jaromil.dyne.org/journal/forkbomb_art.html

>


> Bob