EXPR(1)
โจ EXPR(1) โ the expr glow-up โจ
okay bestie, sit down, we're learning expr ๐
it lives in User Commands land and it literally just... evaluates expressions. that's the whole vibe.
๐ธ NAME ๐ธ
expr โ evaluate expressions ๐งฎโจ
๐ SYNOPSIS ๐
expr EXPRESSION
expr OPTION
๐ DESCRIPTION ๐
--helpโ display this help and exit ๐ฅฐ--versionโ output version information and exit ๐
then it prints the value of EXPRESSION to standard output. the blank line below separates the increasing-precedence groups (so like, the stuff lower down binds tighter, iykyk). EXPRESSION may be:
ARG1 | ARG2โ gives you ARG1 if it's neither null nor0, otherwise ARG2 ๐ฆARG1 & ARG2โ gives you ARG1 if neither argument is null or0, otherwise0๐ARG1 < 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 ARG2 โARG1 - ARG2โ arithmetic difference of ARG1 and ARG2 โARG1 * ARG2โ arithmetic product of ARG1 and ARG2 โ๏ธARG1 / ARG2โ arithmetic quotient of ARG1 divided by ARG2 โARG1 % ARG2โ arithmetic remainder of ARG1 divided by ARG2 ๐STRING : REGEXPโ anchored pattern match of REGEXP in STRING ๐match STRING REGEXPโ same asSTRING : REGEXPfr frsubstr STRING POS LENGTHโ substring of STRING, POS counted from1โ๏ธindex STRING CHARSโ index in STRING where any CHARS is found, or0๐งญlength STRINGโ length of STRING ๐+ TOKENโ interpret TOKEN as a string, even if it is a keyword like'match'or an operator like'/'๐ (this one is the sneaky icon tbh)( EXPRESSION )โ value of EXPRESSION ๐ซถ
โ ๏ธ bestie beware: many operators need to be escaped or quoted for shells. no cap. if you forget, your shell will eat your operators and you'll be sad ๐ญ
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. so basically 0 = slay, 1 = falsy vibes, 2 = syntax said no, 3 = something actually broke ๐
๐ AUTHOR ๐
Written by Mike Parker, James Youngman, and Paul Eggert. legends, honestly ๐ซกโจ
๐ REPORTING BUGS ๐
Report bugs to: <bug-coreutils@gnu.org>. Report any translation bugs to: <https://translationproject.org/team/>. GNU coreutils home page: <https://www.gnu.org/software/coreutils/> General help using GNU software: <https://www.gnu.org/gethelp/>
like pls tell them, they wanna know ๐
๐ COPYRIGHT ๐
Copyright ยฉ 2026 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
๐จ there is NO WARRANTY bestie. none. zero. read it again, to the extent permitted by law.
๐ SEE ALSO ๐
Full documentation <https://www.gnu.org/software/coreutils/expr> or available locally via: info '(coreutils) expr invocation'
and that's the whole page, main character energy only โจ this was GNU coreutils 9.12, dated September 2026 โ go forth and expr responsibly, bestie ๐๐๐ฆ
๐ฆ where this page comes from
- arch rolling: coreutils 9.12-2 ยท GPL-3.0-or-later AND GFDL-1.3-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms