[clug] Ever received a .dat file from an <other OS> user?
Peter Barker
pbarker at barker.dropbear.id.au
Fri Jan 15 16:14:15 MST 2010
On Sat, 16 Jan 2010, Anthony David wrote:
>> This is... somewhat unsafe, particularly when run by root. I *think* I
>> recall a shell trick to turn this into a safe operation, so you *don't* do
>> something unfortunate to your system should those variables be empty. Any
>> takers?
> Hi Peter
>
> One way might be testing for non-zero length strings
>
> [ -n "$dir_i_do_not_want" ] && [ -n "$subdir_i_do_not_want" ] && rm -rf
> $dir_i_do_not_want/$subdir_i_do_not_want
Yes, that certainly a safe way to handle the situation, and what I usually
do. Somewhat verbose, 'though!
Unfortunately, I'm really working on dim memories. I *think* the trick
was something like prepending a few magic characters to the
path-to-be-deleted...
> Anthony
Thanks,
--
Peter Barker | Programmer,Sysadmin,Geek.
pbarker at barker.dropbear.id.au | You need a bigger hammer.
:: It's a hack! Expect underscores! - Nigel Williams
More information about the linux
mailing list