IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New How do I delete a file called --same-owner from /dev?
I did something stupid with tar.

I understand that the -- will cause problems when it's eventually passed to unlink...I hope I don't have to reinstall.

Thanks.
FAQ! We're scrod!
New Re: How do I delete a file called --same-owner from /dev?
in /dev:

ls | grep same-owner | xargs rm -i


HTH


Peter
[link|http://www.debian.org|Shill For Hire]
[link|http://www.kuro5hin.org|There is no K5 Cabal]
[link|http://guildenstern.dyndns.org|Blog]
Expand Edited by pwhysall Dec. 6, 2003, 06:26:13 PM EST
New Re: How do I delete a file called --same-owner from /dev?
rm -- --same-owner

The "--" serves as an end point for checking for command line arguments with GNU tools.

Dave "LordBeatnik"
New or rm "same-owner"
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New ?? No
Unless I misunderstood rickw's question, the file is named "--same-owner". The file name itself starts with --. So, your rm same-owner does nothing.

The GNU getopt() and getopt_long() command line parsing functions try to be smart (some would say too smart) and recognize command line options regardless of location or order on the command line. i.e. ls stupidfile -l is the same as ls -l stupidfile. This causes problems with files that start with - or --, thus the use of a lone "--" to tell the getopts to stop looking for command line options.

For fun, make a file named "-l". Do an ls * in that directory. It will be as if you did ls -l every_file_but_-l.

Dave "LordBeatnik"

EDIT:
To clarify my "-l" file trick, do it in a directory with other files. If you do it in a directory where "-l" is the only file, it will do the detailed ls for -l. (The same as ls -l -- -l). Are you confused yet? 8)
Expand Edited by lordbeatnik Dec. 6, 2003, 08:53:02 PM EST
New eh, slipped meant that by quoting the string, the string is
removed
example rm * is bad but to remove a file called * rm "*" works as intended. It is always fun to place a file called * every now and again
thanx,
bill
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Right in your * example, but wrong for --same-owner
Quotes can protect you from the shell doing substitutions like your "*" example, but this problem isn't caused by the shell. This is about how the actual program interprets its arguments. Do rm "--same-owner" with GNU's rm and it will still barf. The shell will strip the quotes and rm will still see --same-owner as an invalid command line option.

Dave "LordBeatnik"
New Really nasty
I can't find any escapes that will work. I'd have done

find . -name '*owner' -exec rm -i {} \\;

but that is so not elegant.
-drl
New cool yer right, had to use the find|xargs rm
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New Re: cool yer right, had to use the find|xargs rm
This is Nightowl's husband.

Next time, just "rm /dev/--same-owner". It doesn't begin with "--" when you put a directory in front of it. (You could also have done "rm ./--same-owner" while you were in /dev.)

"The difference between being immature and child-like is that one is what you are, and one is what you choose to be."

Comment by Nightowl {O,O}
New good point, also trying to find other methods
thats the fun of nix, how many ways you can skin a cat
thanx,
bill
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New That did it. Thanks!
FAQ! We're scrod!
New echo > '*'
That'll help.
-drl
     How do I delete a file called --same-owner from /dev? - (rickw) - (12)
         Re: How do I delete a file called --same-owner from /dev? - (pwhysall)
         Re: How do I delete a file called --same-owner from /dev? - (lordbeatnik) - (9)
             or rm "same-owner" -NT - (boxley) - (7)
                 ?? No - (lordbeatnik) - (6)
                     eh, slipped meant that by quoting the string, the string is - (boxley) - (5)
                         Right in your * example, but wrong for --same-owner - (lordbeatnik) - (4)
                             Really nasty - (deSitter)
                             cool yer right, had to use the find|xargs rm -NT - (boxley) - (2)
                                 Re: cool yer right, had to use the find|xargs rm - (Nightowl) - (1)
                                     good point, also trying to find other methods - (boxley)
             That did it. Thanks! -NT - (rickw)
         echo > '*' - (deSitter)

Wie geht es Ihnen?
89 ms