Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 01:47:39 -0500
From:      Jim Conner <jconner@enterit.com>
To:        swear@blarg.net (Gary W. Swearingen)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: rm a file named "-l"? ;-)
Message-ID:  <5.1.0.14.0.20011218014357.02b7f6d8@mail.enterit.com>
In-Reply-To: <g1lmg11h8e.mg1@localhost.localdomain>
References:  <5.1.0.14.0.20011217163005.034eacc0@mail.enterit.com> <rl7krl3731.krl@localhost.localdomain> <20011217111215.I21241@xs4all.nl> <20011217111215.I21241@xs4all.nl> <5.1.0.14.0.20011217163005.034eacc0@mail.enterit.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 16:53 12.17.2001 -0800, Gary W. Swearingen wrote:
>Jim Conner <jconner@enterit.com> writes:
>
> > >A quicker way would be to use unlink(1)
> >
> > Thought I would give an example for clarity:
>
>Well thanks for that; that's better for this case, but the wildcard
>method works when the filename starts with (or contains) an unknown
>character like ctrl-M, which you can get in there with the Xemacs shell,
>for example ;-(.

In bash and ksh (perhaps sh but doubtful) you can do ctrl+v control-char to 
get any control character to be placed on the command line.

unlink (ctrl+v)(ctrl+m)file == unlink ^Mfile

eg:

[notjames@njkwan ~]$ unlink ^Mfile
file: No such file or directory
[notjames@njkwan ~]$


Actually, according to the man page, this unlink should be able to do 
directories if you use -d, -R, or -r command line switches.  Although, I 
did not test this.

>IIRC, the SGI unlink could unlink a huge directory in a split second
>(and you'd run "fsck" later to clean up the left-overs), while I notice
>this one doesn't work on directories at all.


- Jim

Philosophy is for those who have nothing better to do than wonder
why philosophy is for those who have nothing better to do than...




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?5.1.0.14.0.20011218014357.02b7f6d8>