[clug] Ever received a .dat file from an <other OS> user?
Peter Barker
pbarker at barker.dropbear.id.au
Fri Jan 15 17:05:25 MST 2010
On Sat, 16 Jan 2010, Andrew Janke wrote:
>>> [ -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!
>
> Unless I (as the naughty user) set both variables to '/'. Or the
> first to / and the second to .
>
> (or did I miss something?)
Not trying to protect against malicious users here.
Really trying to protect against, 'rm -rf
"$dr_i_do_not_want/$subdr_i_do_not want"' (cf 'rm -rf
"$dir_i_do_not_want/$subdir_i_do_not_want"'), or any one of the related
ways to screw yourself over in shell scripting. Where's my "use strict;"?
:-)
> Andrew Janke
Yours,
--
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