![]() |
MT,
My methodology wasn't quite right while testing, upon further tests it does work as described (I was deleting whole dirs that contained the switch); d'oh. Vonleigh |
it's generally considered bad form to alias a true command, i.e., mask it's canonical name.
with rm, doubly so, because one gets false-confidence, and when one is su'd or sudo'd to another account, or remote'd to another machine, and has the bad habit instilled in their mind that they're safe and protected, this will bite. you'll usually hear a loud "Oh ****!" followed by denial, weeping, anger, fear, flop-sweat, chagrin, the whole gamut. another trick and good habit. never use a naked rm without seeing its results first. you can do this by proceeding rm with echo... Code:
$ lsyou can use this trick most anywhere as it merely expands the glob term and spits it to stdout. |
just a little comment on the sudo thing.. you don't have to know the sudo password, if it's already been entered into that terminal window. if your friend somehow got you to enter your password while helping you do someother stuff, and then ran that script later.. you left yourself wide open.
|
for 5 minutes...
% man sudo
... "Once a user has been authenticated, a timestamp is updated and the user may then use sudo without a password for a short period of time (5 minutes unless overridden in sudoers)..." % sudo -k # expire sudo timeout now (kill) % sudo -v # renew sudo timeout for another N minutes (validate) |
Heads up!
Just as a warning about using the magical "touch ./\-i" trick, it does NOT work if you have a file in the directory whose name begins with a space. In fact, I imagine that it wont work if you have ANY file with a character that is sorted in "before" the "-". When this is the case, "rm -rf *" merely deletes everything, including the "-i" file.
Sorry if this isnt formatted nicely enough for you, but its my first reply. |
thanks, gowmc. yep. there are quite a few chars that collate before '-' in the roman ascii context...
Code:
040 sp 041 ! 042 " 043 # 044 $ 045 % 046 & 047 'some of these chars should not be used in filenames at all. e.g., if you use an odd number of ticks in a filename, you're going to have a lot of trouble getting that sucker thru filters. and none of them should be characters that you start your filenames with! if you want filenames to collate before alpha names, use a number scheme. |
make the -i file start with spaces
I haven't tried this - but it seems to me that you could ensure that the -i file trick described above will always work if you create the file with a bunch of spaces before the -i in its name.
|
| All times are GMT -5. The time now is 06:12 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.