| 运算符 | 描述 | 范例 |
| =,+=,-=,*=,%=,^= | 赋值运算符(Assignment Operators) | |
| expr1 ?expr2 :expr3 | C条件表达式(C Conditional Expression) | expression中无法写执行语句,只能赋值变量# awk -v num1=22 -v num2=31 'BEGIN {max=(num1>num2)?num1:num2;print “MAX number is "max}'MAX number is 31# awk -F: '{$3>=1000?usertype="Common User":usertype="Sysadmin or SysUser";printf "%20s:%-s/n",$1,usertype}' /etc/passwd |
| &&(AND) ||(OR) !(NOT) | 逻辑运算符(Logical Operators) | |
| < <= == != > >= ~(match) !~(not match) | 关系运算符 (Relational Operators) | |
| + - * / % ^ | 算术运算符(Arithmetic Operatiors) | |
| ++(Increment Operator)--(Decrement Operator) | 自增与自减运算符(Increment and Decrement Operators) | |
| +(正号),-(负号) | 单目运算符 | |
| 空格 | 拼接运算符 |
新闻热点
疑难解答