expr(1)
π expr(1) β the general commands manual glow-up π
okay bestie, welcome to expr(1), a page from the General Commands Manual that's about to become your whole personality. she prints the value of an expression to standard output, and honestly? iconic behaviour. π
β¨ NAME β¨
expr β Print the value of EXPRESSION to standard output. that's it. that's the job. π
πΈ SYNOPSIS πΈ
expr [--version] [--help] [expression]
π¦ DESCRIPTION π¦
Print the value of EXPRESSION to standard output. literally, that's what she does. no cap. π«Ά
π OPTIONS π
--versionβ output version information and exit. bye girl, she's leaving to tell you her version π--helpβ display this help and exit. she's helping!! she's so helpful!! π§[expression]β the expression, optional bracket situation, slay π
π EXTRA π
Print the value of EXPRESSION to standard output. A blank line below separates increasing precedence groups. (iykyk β the groups stack up in priority, and the blank line is the little vibe check between them β¨)
EXPRESSION may be:
ARG1 | ARG2: ARG1 if it is neither null nor 0, otherwise ARG2ARG1 & ARG2: ARG1 if neither argument is null or 0, otherwise 0ARG1 < ARG2: ARG1 is less than ARG2ARG1 <= ARG2: ARG1 is less than or equal to ARG2ARG1 = ARG2: ARG1 is equal to ARG2ARG1 != ARG2: ARG1 is unequal to ARG2ARG1 >= ARG2: ARG1 is greater than or equal to ARG2ARG1 > ARG2: ARG1 is greater than ARG2ARG1 + ARG2: arithmetic sum of ARG1 and ARG2ARG1 - ARG2: arithmetic difference of ARG1 and ARG2ARG1 * ARG2: arithmetic product of ARG1 and ARG2ARG1 / ARG2: arithmetic quotient of ARG1 divided by ARG2ARG1 % ARG2: arithmetic remainder of ARG1 divided by ARG2STRING : REGEXP: anchored pattern match of REGEXP in STRINGmatch STRING REGEXP: same asSTRING : REGEXPsubstr STRING POS LENGTH: substring of STRING, POS counted from 1index STRING CHARS: index in STRING where any CHARS is found, or 0length STRING: length of STRING+ TOKEN: interpret TOKEN as a string, even if it is a keyword likematchor an operator like/( EXPRESSION ): value of EXPRESSION
bestie, listen: Beware that many operators need to be escaped or quoted for shells. this is not a drill, this is the shell's whole deal π
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.
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. she's got β¨rangeβ¨ fr fr π₯
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
π VERSION π
v(uutils coreutils) 0.7.0
mwah π that's the whole page, and honestly? she ate. this was expr from uutils coreutils, version 0.7.0, straight out of the General Commands Manual β go forth and print some expressions, main character ππ¦π
π¦ where this page comes from
- epel 10: rust-coreutils-devel 0.7.0-10.el10_3 Β· MIT
- epel 10: uutils-coreutils 0.7.0-10.el10_3 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- fedora 43: rust-coreutils-devel 0.7.0-12.fc43 Β· MIT
- fedora 43: uutils-coreutils 0.7.0-12.fc43 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- fedora 44: rust-coreutils-devel 0.7.0-4.fc44 Β· MIT
- fedora 44: uutils-coreutils 0.7.0-4.fc44 Β· (MIT OR Apache-2.0) AND Unicode-DFS-2016 AND Zlib AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR Apache-2.0 WITH LLVM-exception) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND CC0-1.0 AND ISC AND MIT AND (MIT OR Zlib OR Apache-2.0) AND (MIT-0 OR Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms