The zsh man page, in its section on test (aka [), explicitly advises against using it at all, and urges readers to use [[ whenever possible.The relevant section states:The command attempts to implement POSIX and its extensions where these are specified. Unfortunately there are intrinsic ambiguities in the syntax; in particular there is no distinction between test operators and strings that resemble them. The standard attempts to resolve these for small numbers of arguments (up to four); for five or more arguments compatibility cannot be relied on. Users are urged wherever possible to use the '[[' test syntax which does not have these ambiguities.I think I've come across similar advice for bash, but as I scan over the bash man page I can't find any official recommendation there on which form ([ or [[) to use.  (Maybe I missed it?)Is there any reason, other than backward compatibility with older shells, for using [ in a bash script?  Or to put it differently, does bash keep [ along with [[ for reasons other than backward compatibility?
[ vs [[ : which one to use in bash scripts?
bash;shell script;zsh;control flow;test
The reason to prefer [ over [[ if sufficient is that [ is more stable between the different bash versions. See man bash:compat31If set, bash changes its behavior to that of version 3.1 with respect to quoted arguments to the [[ conditional command's =~ operator.compat32If set, bash changes its behavior to that of version 3.2 with respect to locale-specific string comparison  when using the [[ conditional command's < and > operators.  Bash versions prior to bash-4.1 use ASCII collation and strcmp(3); bash-4.1 and later use the current locale's collation sequence and strcoll(3).compat40If set, bash changes its behavior to that of version 4.0 with respect to locale-specific string comparison  when using the [[ conditional command's < and > operators (see previous item) and the effect of interrupting a command list.Maybe it is also a little bit more common to users with ksh background.Note about performance'[[' is quicker as '[' For a singular invocation the speed difference has no commensurable impact, and your should prefer the '[' builtin.If you it inside a bigger loop construct, you may think of replace '[' with '[['For a measurement you may use the following compare script let upperBound=$1echo check [,  ${upperBound} iterationslet i=0time while [ $i -lt ${upperBound} ] ; do let i++ ; doneecho; echo;echo check [[, ${upperBound} iterationslet i=0time while [[ $i < ${upperBound} ]] ; do let i++ ; doneResult of compare scriptcheck [,  1000 iterationsreal    0m0.031s  user    0m0.028s  sys     0m0.004scheck [[, 1000 iterationsreal    0m0.000s  user    0m0.000s  sys     0m0.000s