EXPR(1)
π EXPR(1) π
okay bestie, welcome to EXPR(1) from the General Commands Manual β name tag folded in right here, no cap π«Ά. This is the page for expr, and it is literally here to print the value of EXPRESSION to standard output. main character energy only π
β¨
πΈ NAME πΈ
expr β Print the value of EXPRESSION to standard output. That's the whole gig, and it ate. π
β¨ SYNOPSIS β¨
Two moods, both iconic:
expr [EXPRESSION]
expr [OPTIONS]
π¦ DESCRIPTION π¦
Print the value of EXPRESSION to standard output. No cap, that's the entire point of this icon. π
π OPTIONS π
--versionβ output version information and exit.--helpβ display this help and exit.[expression]β the expression goes here, brackets kept exactly like the page lists them. π
π EXTRA π
A blank line below separates increasing precedence groups.
So when you see the blank lines, that's the precedence glow-up happening. β
π EXPRESSION may be: π
ARG1 | ARG2βARG1if it is neither null nor0, otherwiseARG2.ARG1 & ARG2βARG1if neither argument is null or0, otherwise0.ARG1 < ARG2βARG1is less thanARG2.ARG1 <= ARG2βARG1is less than or equal toARG2.ARG1 = ARG2βARG1is equal toARG2.ARG1 != ARG2βARG1is unequal toARG2.ARG1 >= ARG2βARG1is greater than or equal toARG2.ARG1 > ARG2βARG1is greater thanARG2.ARG1 + ARG2β arithmetic sum ofARG1andARG2.ARG1 - ARG2β arithmetic difference ofARG1andARG2.ARG1 * ARG2β arithmetic product ofARG1andARG2.ARG1 / ARG2β arithmetic quotient ofARG1divided byARG2.ARG1 % ARG2β arithmetic remainder ofARG1divided byARG2.STRING : REGEXPβ anchored pattern match ofREGEXPinSTRING.match STRING REGEXPβ same asSTRING : REGEXP.substr STRING POS LENGTHβ substring ofSTRING,POScounted from1.index STRING CHARSβ index inSTRINGwhere anyCHARSis found, or0.length STRINGβ length ofSTRING.+ TOKENβ interpretTOKENas a string, even if it is a keyword likematchor an operator like/.( EXPRESSION )β value ofEXPRESSION.
β οΈ Beware that many operators need to be escaped or quoted for shells.
Comparisons are arithmetic if both ARGs are numbers, else lexicographical. Pattern matches return the string matched between \( and \) or null; if \( and \) are not used, they return the number of characters matched or 0. This is the part where shell quoting is your bestie, not your enemy. π
π¦ Exit status π¦
Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred. Periodt. π
π§ Environment variables: π§
EXPR_DEBUG_TOKENS=1: dump expression's tokensEXPR_DEBUG_RPN=1: dump expression represented in reverse polish notationEXPR_DEBUG_SYA_STEP=1: dump each parser stepEXPR_DEBUG_AST=1: dump expression represented abstract syntax tree
Errors are reported with the expression echoed back and a caret under the offending argument whenever stderr is a terminal; anything else reading stderr gets the usual single-line message. So if your terminal is getting the fancy caret treatment, that's the vibe β otherwise it's the usual single-line message, iykyk. π«Ά
π VERSION π
v(uutils coreutils) 0.12.0
this iconic page is serving source/version v(uutils coreutils) 0.12.0 and is dated 2026-09-17 β mwah, bestie ππ«Ά
π¦ where this page comes from
- arch rolling: uutils-coreutils 0.12.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms