Skip to content

Conversation

@SeerLite
Copy link
Contributor

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

Previously showed "line 130: 3: unbound variable" instead of the
pretty error message.
dunstctl Outdated
[ "${state}" = "nope" ] \
&& die "No valid rule state parameter specified. Please give either 'enable', 'disable' or 'toggle'"
case "${3:-}" in
("disable")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with the remaining file the opening parenthesis should be removed and the final ;; for each case should be put an its own line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! However I was basing this style on this same file here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use the same style as the main case. I didn't touch the other unrelated case though.

@SeerLite SeerLite force-pushed the dunstctl-rule-error branch from 70d9c60 to e647242 Compare February 18, 2024 22:58
@SeerLite SeerLite force-pushed the dunstctl-rule-error branch from e647242 to 02a3908 Compare February 18, 2024 23:00
@bynect
Copy link
Contributor

bynect commented Feb 29, 2024

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

@SeerLite
Copy link
Contributor Author

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

@bynect
Copy link
Contributor

bynect commented Feb 29, 2024

Thanks 👍🏻

@bynect bynect merged commit d55836f into dunst-project:master Feb 29, 2024
@zappolowski
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants