On 2024-12-20 03:17, Steffen Nurpmeso via Postfix-users wrote:
>  |> 
>  |> This seems wrong:
>  |> 
>  |>  if [ ! "$set" ]; then
> 
> i think this is right for sh(1).
> This is because [] with the basic set of arguments is very exactly
> defined for compatibility reasons.  See test(1) which states
> 
>        STRING equivalent to -n STRING
> 
> And then [ ! "" ] is ok.  (Even though *i* shiver when i see the

Was it supposed to detect empty string while having [yn] values
elsewhere? This is bad coding practice.
If you want to check for empty string, you do explicit [ -z.

>  |...not mentioning using reserved word as a variable.
> 
> Hm, but a variable has the dollar prefix, so it shouldn't clash.

When referenced there is $, when set (nomen omen) there isn't.
Bad coding practice.
Of course you can program using emoji or whitespace in variables, but
that quickly fails apart when someone else in the future modifies the
code being not aware of all the kludges and traps left by the author.
It's just too easy to skip some $ and keep valid syntax, not noticing
changed behavior.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to