Date: Sat, 31 Mar 2007 21:53:42 +0200 From: Erik Trulsson <ertr1013@student.uu.se> To: lalev@uni-svishtov.bg Cc: freebsd-questions@freebsd.org Subject: Re: deleting file '--preserve-permissions' Message-ID: <20070331195342.GA12117@owl.midgard.homeip.net> In-Reply-To: <1794.212.25.54.147.1175369763.squirrel@mail.uni-svishtov.bg> References: <1794.212.25.54.147.1175369763.squirrel@mail.uni-svishtov.bg>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 31, 2007 at 10:36:03PM +0300, lalev@uni-svishtov.bg wrote:
> I've made mistake with tar. Something like
>
> tar cvfz --preserve-permissions home.tgz *
>
> or
>
> tar cvfz --preserve-permissions * home.tgz
>
> As result I have a file with name '--preserve-permissions'.
> It seems that it's not easy to delete this file.
>
> rm '--preserve-permissions'
>
> does not give the desired result.
> What should I do :-)
You should read the rm(1) man-page.
Especially the part that says:
NOTE
The rm command uses getopt(3) to parse its arguments, which allows it to
accept the --' option which will cause it to stop processing flag
options at that point. This will allow the removal of file names that
begin with a dash (-'). For example:
rm -- -filename
The same behavior can be obtained by using an absolute or relative path
reference. For example:
rm /home/user/-filename
rm ./-filename
--
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070331195342.GA12117>
