I want to check if [[ $var == foo || $var == bar || $var == more ]] without repeating $var n times.
Here's a portable solution:
case $var in foo|bar|more) ... ;; esac
And here's one that uses '[[':
if [[ $var =~ foo|bar|more ]]; then ... fi
Here's a portable solution:
case $var in foo|bar|more) ... ;; esac
And here's one that uses '[[':
if [[ $var =~ foo|bar|more ]]; then ... fi