Automation, Orchestration, and Scripting

A script sets a=9 and b=10, then runs [[ $a > $b ]] && echo "a is larger". The script prints "a is larger". What explains this result?

Show the answer

Correct answerB. The values are compared as strings, and the character 9 sorts after the character 1.

Inside [[ ]], > is a lexicographic string comparison, so "9" sorts after "10" because 9 follows 1 in character order. It does not convert to integers; numeric comparison needs -gt or an arithmetic (( )) expression.