operator
A symbol or keyword used in shell commands and programming to perform operations on variables, strings, or values, such as arithmetic, comparison, or logical operations.
Operators are special symbols or words that tell the shell or a programming language to perform specific actions on operands (values or variables). Common types include arithmetic operators (+, -, *, /) for math, comparison operators (==, !=, -lt, -gt) for testing values, and logical operators (&&, ||, !) for combining conditions.
In the bash shell, operators are used extensively in conditionals and arithmetic expansions. For example, if [ $count -gt 10 ]; then uses the -gt (greater than) operator to compare the variable $count with 10.
Different contexts use operators differently: the test command uses string and numeric operators like -eq and -z, while arithmetic expansion uses standard math operators inside $(( )) syntax, such as result=$((5 + 3)).