⇤ ← Revision 1 as of 2007-05-03 00:00:48
Size: 191
Comment:
|
Size: 323
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
== I want to check if [[ $var == foo || $var == bar || $var = more ]] without repeating $var n times. == | == I want to check if [[ $var == foo || $var == bar || $var == more ]] without repeating $var n times. == |
Line 4: | Line 4: |
Here's a portable solution: | |
Line 9: | Line 10: |
And here's one that uses '[[': {{{ if [[ $var =~ foo|bar|more ]]; then ... fi }}} |
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