Operating System - Tru64 Unix
1748019 Members
4801 Online
108757 Solutions
New Discussion юеВ

File with the name of '-.'

 
SOLVED
Go to solution
Victor Semaska_3
Esteemed Contributor

File with the name of '-.'

Greetings,

I thought I saw an thread about this type of problem before but can't find it.

On a DS25 running V5.1B Patch Kit 4 there's a file with the name of '-.'. I can't delete. Anyone know how to do this?

# ls -l
-rwxr-xr-x 1 obanner sysodba 10240 Jan 5 2004 -.

# rm '-.'
rm: illegal option -- .
usage: rm [-efirR] file ...

# rm -e "-."
rm: illegal option -- .
usage: rm [-efirR] file ...

Thanks,
Vic
There are 10 kinds of people, one that understands binary and one that doesn't.
4 REPLIES 4
Mark Poeschl_2
Honored Contributor

Re: File with the name of '-.'

Couldn't get anything from the shell to work, but this C code worked for me:

#include
#include
#include
main ()
{
char name[5] = "./-.\0";
int desc;

desc = unlink (name);

}
Hein van den Heuvel
Honored Contributor
Solution

Re: File with the name of '-.'

just use a double-dash (--) to stop option parsing.
So the solution would be:

rm -- -


or


rm ./-


or

find . -name "-" -exec rm {} \;


Hein.

Victor Semaska_3
Esteemed Contributor

Re: File with the name of '-.'

Thanks,

The '-- -.' & './-.' both worked.

Vic
There are 10 kinds of people, one that understands binary and one that doesn't.
Victor Semaska_3
Esteemed Contributor

Re: File with the name of '-.'

See above.
There are 10 kinds of people, one that understands binary and one that doesn't.