dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.56k stars 340 forks source link

Fix `dunstctl rule` error when not providing rule state #1281

Closed SeerLite closed 7 months ago

SeerLite commented 7 months ago

Previously showed "line 130: 3: unbound variable" instead of the pretty error message.

bynect commented 7 months ago

So the problem was the reference to "${3}"?

SeerLite commented 7 months ago

Yes, the first commit just changes "$3" to "${3:-}" and second one replaces with the if with a case

bynect commented 7 months ago

Thanks 👍🏻

zappolowski commented 7 months ago

The issues comes from using set -u when there are not enough arguments provided. $3 is undefined and thus triggers the original error. ${3:-} uses the empty fallback in this case to avoid the issue.