On Wed, 12 May 2004 19:11:56 +0000
<dutchman_mn at charter.net> wrote:

> Question:  How do you delete a directory that starts with ${
> 
> I have a number of directories like ${foo}
> 
> When I try, it a bad substitution error out of bash.

When I get these types of things I usually do the following instead of attempting to use substitution and escape characters, one time I started accidentally deleting files from / doing that.  Anyway:

1.) Make a temp dir outside the dir with the goofy named files.
2.) Move all the files/dirs you want to KEEP into the temp dir.  Now you should have a directory containing only the files with garbage names.  (Don't forget to check for dot-files)
3.) Note the permissions of your directory.  Go up a level and rm -rf the dir you were in containing the garbage files.  (you can also rm -rf * while inside the directory to skip step 4, but think before you press return)
4.) Re-create the dir with the same perms.
5.) Move the files from the temp dir back to the directory.

This does little for you if you want to rename one of those files.  If you can do this as a non-root user, do it.

I realize this is not the easist or most elegant solution and other list members are probably shaking their heads, but I've personally found it to be the safest for these situations and it's easier than remembering escape characters or writing a script to do it.

Josh

_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
Help beta test TCLUG's potential new home: http://plone.mn-linux.org
Got pictures for TCLUG? Beta test http://plone.mn-linux.org/gallery
tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list