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
The expr utility has a rather difficult syntax [...] In many cases, the arithmetic and string features provided as part of the shell command language are easier to use than their equivalents in expr. Newly written scripts should avoid expr in favor of the new features within the shell.
Contraindications
sh doesn't have a great replacement for the : operator (regex match). ShellCheck tries not to warn when using expr with :, but e.g. op=:; expr string "$op" regex still trigger it.
Other than that, all uses of expr can be rewritten to use modern shell features instead.
Bash has [[ string =~ regex ]], so not even expr .. : .. is necessary.