bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: currently doable? Indirect notation used w/a hash


From: Chris F.A. Johnson
Subject: Re: currently doable? Indirect notation used w/a hash
Date: Mon, 10 Jun 2013 18:20:44 -0400 (EDT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

On Mon, 10 Jun 2013, Linda Walsh wrote:


  Point taken, but the only way such a string would be passed as a
  variable name is if it was given as user input -- which would,
  presumably, be sanitized before being used. Programming it literally
  makes as much sense as 'rm -rf /'.
---
        That still didn't POSIX-Gnu rm from disabling that ability.

   Did they? I'm not going to test it :(

        Though the one that really causes a pain is them removing
the ability to safely delete all files in a directory with the 'rm' command.

  Since when?

        Now, many contortions are necessary.

        (i.e.:   "cd testing/output/ && rm --one-file-system  -fr ."
used to safely deleted everything in output -- except the "." --
but it was 'last' (recursive 'rm' has to be depth first), and
the -f would suppress the error you got about not being able to remove ".".

   Contortions???

Now they put in a special check to check the starting arguments first,
before doing the depth-first remove and abort any processing for files
in "." You need to use 'find' with alot more typing to do something similar.

  What's wrong with:

rm -rf *

--
   Chris F.A. Johnson, <http://cfajohnson.com/>
   Author:
   Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]