Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Dec 2000 19:23:42 -0600 (CST)
From:      Mike Meyer <mwm@mired.org>
To:        Cliff Sarginson <cliff@raggedclown.net>
Cc:        Ryan Younce <ryan@manunkind.org>, Joe Oliveiro <joe@advancewebhosting.com>, Mike Meyer <mwm@mired.org>, Larry Rosenman <ler@lerctr.org>, Daniel.Bye@uk.uu.net, questions@freebsd.org
Subject:   Re: Pesky file
Message-ID:  <14888.20254.298529.549656@guru.mired.org>
In-Reply-To: <00120201170201.04232@buffy>
References:  <14888.4617.148599.530943@guru.mired.org> <Pine.BSF.4.21.0012011703120.17623-100000@joe.pythonvideo.com> <20001201190335.A35590@cheshire.manunkind.org> <00120201170201.04232@buffy>

next in thread | previous in thread | raw e-mail | index | archive | help
Cliff Sarginson <cliff@raggedclown.net> types:
> Mmm..
> It's nearly Christmas so a small prize may be awarded
> if you can get rid of a file whose name is
> -<bs>*<bs>
> 
> Where <bs> is the backspace character.

So you want to remove a file that looks like this:

guru$ ls -b -- -*
-\b*\b

How you quote the <bs> character to get it past the input routines
will depend on your tty settings (specifically, lnext). Letting <bs>
stand for the appropriate sequence of keystrokes to get the <bs> fed
to rm, it can be done by one of: "rm -- '-<bs>*<bs>'", "rm ./-<bs>\*<bs>",
or similar things.

You can use printf to eliminate the lnext dependency, but if your
erase character isn't C-h, you'll need to use something other than \b
for the escape sequence.

	rm `printf "./\b*\b"`

However, you may trip over some shells having printf as a builtin, so
you can use a suitable scripting language (with the same caveat about
\b):

	python -c "import os; os.unlink('-\b*\b')"

And of course, to be *really* ham-handed about it, you can always use
clri followed by an fsck.

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Unix/FreeBSD consultant,	email for more information.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14888.20254.298529.549656>