help-gnu-utils
[Top][All Lists]
Advanced

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

Re: removing file with newlines in name


From: Brenda J. Butler
Subject: Re: removing file with newlines in name
Date: Tue, 30 Nov 2004 19:54:23 -0500
User-agent: Mutt/1.3.28i

On Tue, Nov 30, 2004 at 06:55:23PM +0100, Frederik Fouvry wrote:
> 
> ,-- One day, you wrote:
> 
> [...]
> 
> | 
> | keep trying regexp patterns like "ls case*" or "ls *case*", until only
> | that file shows up; then "rm" the pattern you are satisfied with.
> 
> $ \ls case*
> ls: case 't':   get_all_tables = 1;
>                         break;
>             case 'T':   get_all_tables = 2;
> : Invalid argument


Funny that the error messages miss the last line with "cd".

Try setting the IFS variable in your shell to something that doesn't
appear in that file name (hard to find a character that doesn't
appear there, to be sure :-)

IFS is the shell variable that contains the characters that are used
by the shell to tell when one token ends or begins.  Normally it is
set to "blank-tab-newline", thus blanks, tabs and newlines separate
tokens in the shell.

When you have to change it, normally you use the following
template:

    OLDIFS="$IFS"
    IFS="X"

    stuff you have to do

    IFS="$OLDIFS"

because it's a bit tricky setting it to the original value (the
chars have to be in the right order to have the original magic
semantics).

And there's always the old "put a relative path before the filename"
trick (which you may have tried already):

  rm ./'blah
blah<tab>blah
blah'

Good luck.

You can always use C or perl to open the directory, readdir
through till you get to the entry of interest and unlink it.

-- 
bjb at istop dot com
Open Source Weekend       http://www.osw.ca
5F82 9855 E247 1F8A 49CD  053E FB03 E77F 2A19 D707




reply via email to

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