On Fri, Feb 17, 2012 at 5:03 AM, Michael Rasmussen <[email protected]>wrote:

> while on #bash I jumped in to help someone:
>
> <MichaelRpdx>   mr-green06: or perhaps mkdir -p $var
>    <Riviera>   !umq > MichaelRpdx
>
> The !umq was a reminder to me because I'd given mr-green06 bad advice.
>
> Can you tell what I'd done wrong?  at a glance?
>
>
without more context, it's hard to say what Mr. Riviera was complaining
about. I would start with that all variables should be quoted whenever
possible. mkdir -p "$var"

if this were used in a script, perhaps one enabled for a user via sudo, you
could create a serious security hole by not quoting your variable.

it's better not to worry about whether it's dangerous in this instance or
that one or not but maybe a little or what if I'm the only user but maybe
someday this could go somewhere with more exposure... just quote it every
time. :)

it's also possible that the complainer did not think that was the most
optimal solution to mr-green06's problem. if we knew what that was, we
might be able to offer more insight.

-wes
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to