[[ $x ]] just tests whether the variable $x is of length 0 or not. So its performance should not depend on how long the variable is.
But the following test case shows that the run time does depend on the length of the variable. Should it be considered as a performance bug of bash? $ x=$(printf '%.sx' {1..1000000}) $ time [[ $x ]] real 0m0.004s user 0m0.003s sys 0m0.000s $ x=$(printf '%.sx' {1..10000000}) $ time [[ $x ]] real 0m0.043s user 0m0.039s sys 0m0.004s -- Regards, Peng