1 |
On Friday, February 03, 2012 10:14:42 PM Nirbheek Chauhan wrote: |
2 |
> >> if [[ ${x} = en ]] || [[ ${x} = en-US ]]; then |
3 |
> > |
4 |
> > should be == imo |
5 |
> |
6 |
> Fixed |
7 |
|
8 |
I prefer == for [[ too, but no difference. = is required for [ by POSIX but |
9 |
Bash allows either (bad though). The real issue is executing two commands |
10 |
since [[ can short-circuit and works as you expect. Two are only needed with [ |
11 |
because -a and -o are so unpredictable. |
12 |
|
13 |
[[ $x == en || $x == en-US ]] |
14 |
or |
15 |
case $x in en|en-US) ...;; esac; |
16 |
or |
17 |
[[ $x == @(en|en-US) ]] |
18 |
or |
19 |
[[ $x == en?(-US) ]] |
20 |
-- |
21 |
Dan Douglas |