Journal Cliff's Journal: Using ".*" Almost Always Results in Something You Don't Want 14
OK, this might seem like an unnecessary rant, but I, like this
poster have been caught by the ".*" bug when issuing Unix commands. I think it's kind of rediculous that most unix commands will do an UPWARD recursive traversal (thanks to the ".." directory entry) as well as a downwards traversal. Most folks, when dealing with TREE structures only expect the latter, not realizing that the former is always possible.
Why is it that Unix commands, expecially rm, and chmod deal with the ".." directory entry without a specific flag telling them to do so? I think it's downright misleading and this feature will cause more problems than it solves as people learn Unix.
Yes, you can replace ".*" with ".[^.]*", but it's extra typing an unintuitive for most people, so why not add in the extra flag.
Basically, this is me writing a journal entry trying to tell a computer to "Do what I say, not what I mean!"
Bored am I! Move along, now. Nothing to see, here.
Why is it that Unix commands, expecially rm, and chmod deal with the ".." directory entry without a specific flag telling them to do so? I think it's downright misleading and this feature will cause more problems than it solves as people learn Unix.
Yes, you can replace ".*" with ".[^.]*", but it's extra typing an unintuitive for most people, so why not add in the extra flag.
Basically, this is me writing a journal entry trying to tell a computer to "Do what I say, not what I mean!"
Bored am I! Move along, now. Nothing to see, here.
If you can find me a bit of (Score:1)
And, unless you do -r or a -f, it prompts you and doesn't recurse. So most newbies should figure out that
Then they can hop on
ch-owns-me (Score:2)
Re:If you can find me a bit of (Score:1)
My co-workers and I refer to this as the 'ESP API. Usually followed with whisking a pen across the forehead and saying, "I just sent you an email about it."
Re:If you can find me a bit of (Score:1)
"See that, it's been up since before your OS was released." - Said to an MCSE who was bragging about his W2k uptime complete with a finger point to the system in question.
.??* [my subject needs alphas] (Score:2)
Re:.??* [my subject needs alphas] (Score:2)
Need a whole bunch of tweaking
Annoying, aren't they?
Gah! I can't stop writing Haiku's. I blame daoine [slashdot.org].
Re:.??* [my subject needs alphas] (Score:1)
Lameness filters inhibit
Good conversation!
Damn you editor!
You made me add a new friend
A haiku speaker!
Re:.??* [my subject needs alphas] (Score:2)
This is all a part of my
Evil cunning plan!
Re:.??* [my subject needs alphas] (Score:1)
It is creepy when it does.
Truly, stop Sir Cliff.
Someone get me off of this thing... (Score:2)
Has gotten worse with this bit
Stuck with writ haikus.
It's not a bug, but ByDesign. (Score:2)
It's just doing what you told it. "." and ".." appear in your directory listings because they really are nothing more than files. Therefore when you use ".*", you will naturally match "..", and if you tell the command to recurse, of course it is going to go up
Yes, and I'm just saying... (Score:2)
Oh, nevermind.
Re:Yes, and I'm just saying... (Score:2)
Hey, at least the wildcard expansion is done by the shell, not each and every command line utility. That way it is consistently flawed across all utilities unlike Winders, where, if you do get wild card support on the command line, it is likely that the coder implemented his own, twisted idea of how to do the expansion. That was one thing I could never get used to in DOS/Windows...
Simple solution though - write your own! Isn't that how the Open Source religion works?
Or I could just patch 'rm' and 'chmod' (Score:2)
If "-r" is used, and $entry==".." then check for the presence of another switch, like "--yes-you-may-recurse-upwards".