Comment

Comment by mike-bailey

The __bma_read_filters function is designed to take all arguments and join them with | to create a grep pattern. Adding quotes around $@ would break this functionality because:

__bma_read_filters "arg1 arg2" arg3

With unquoted $@:

• Gets word split into: arg1 arg2 arg3 • Results in: arg1|arg2|arg3

With quoted "$@":

• Would be passed as: "arg1 arg2" arg3 • Results in: "arg1 arg2"|arg3

The unquoted version is correct here since the function is intentionally using word splitting to create individual grep pattern elements.

This is one of those cases where the normal "always quote your variables" rule has a valid exception because word splitting is part of the intended behavior.

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton