You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
evaluate_strictness()
{
[["$2" =~ ^-(-(config|command|help|version)$|[chv]) ]] && die "You have passed '$2' as a value of argument '$1', which makes it look like that you have omitted the actual value, since '$2' is an option accepted by this script. This is considered a fatal error."
}
Make the script fail if setopt -o errexit is set, as if the comparison is "false" the return value is also false -> and bash kill the process.
One solution could be to negate the comparison:
evaluate_strictness()
{
[[ ! "$2" =~ ^-(-(config|command|help|version)$|[chv]) ]] || die "You have passed '$2' as a value of argument '$1', which makes it look like that you have omitted the actual value, since '$2' is an option accepted by this script. This is considered a fatal error."
}
Or add a return 0 after the [[]], like
evaluate_strictness()
{
[["$2" =~ ^-(-(config|command|help|version)$|[chv]) ]] && die "You have passed '$2' as a value of argument '$1', which makes it look like that you have omitted the actual value, since '$2' is an option accepted by this script. This is considered a fatal error."
return 0
}
The text was updated successfully, but these errors were encountered:
The following statement
Make the script fail if
setopt -o errexit
is set, as if the comparison is "false" the return value is also false -> and bash kill the process.One solution could be to negate the comparison:
Or add a return 0 after the
[[]]
, likeevaluate_strictness()
{
[["$2" =~ ^-(-(config|command|help|version)$|[chv]) ]] && die "You have passed '$2' as a value of argument '$1', which makes it look like that you have omitted the actual value, since '$2' is an option accepted by this script. This is considered a fatal error."
return 0
}
The text was updated successfully, but these errors were encountered: