139 lines
4.1 KiB
HTML
139 lines
4.1 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of EXPR</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>EXPR</H1>
|
|
Section: User Commands (1)<BR>Updated: September 2019<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
expr - evaluate expressions
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>expr</B>
|
|
|
|
<I>,EXPRESSION/</I>
|
|
<BR>
|
|
|
|
<B>expr</B>
|
|
|
|
<I>,OPTION/</I>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>--help</B><DD>
|
|
display this help and exit
|
|
<DT id="2"><B>--version</B><DD>
|
|
output version information and exit
|
|
</DL>
|
|
<P>
|
|
|
|
Print the value of EXPRESSION to standard output. A blank line below
|
|
separates increasing precedence groups. EXPRESSION may be:
|
|
<DL COMPACT>
|
|
<DT id="3">ARG1 | ARG2<DD>
|
|
ARG1 if it is neither null nor 0, otherwise ARG2
|
|
<DT id="4">ARG1 & ARG2<DD>
|
|
ARG1 if neither argument is null or 0, otherwise 0
|
|
<DT id="5">ARG1 < ARG2<DD>
|
|
ARG1 is less than ARG2
|
|
<DT id="6">ARG1 <= ARG2<DD>
|
|
ARG1 is less than or equal to ARG2
|
|
<DT id="7">ARG1 = ARG2<DD>
|
|
ARG1 is equal to ARG2
|
|
<DT id="8">ARG1 != ARG2<DD>
|
|
ARG1 is unequal to ARG2
|
|
<DT id="9">ARG1 >= ARG2<DD>
|
|
ARG1 is greater than or equal to ARG2
|
|
<DT id="10">ARG1 > ARG2<DD>
|
|
ARG1 is greater than ARG2
|
|
<DT id="11">ARG1 + ARG2<DD>
|
|
arithmetic sum of ARG1 and ARG2
|
|
<DT id="12">ARG1 - ARG2<DD>
|
|
arithmetic difference of ARG1 and ARG2
|
|
<DT id="13">ARG1 * ARG2<DD>
|
|
arithmetic product of ARG1 and ARG2
|
|
<DT id="14">ARG1 / ARG2<DD>
|
|
arithmetic quotient of ARG1 divided by ARG2
|
|
<DT id="15">ARG1 % ARG2<DD>
|
|
arithmetic remainder of ARG1 divided by ARG2
|
|
<DT id="16">STRING : REGEXP<DD>
|
|
anchored pattern match of REGEXP in STRING
|
|
<DT id="17">match STRING REGEXP<DD>
|
|
same as STRING : REGEXP
|
|
<DT id="18">substr STRING POS LENGTH<DD>
|
|
substring of STRING, POS counted from 1
|
|
<DT id="19">index STRING CHARS<DD>
|
|
index in STRING where any CHARS is found, or 0
|
|
<DT id="20">length STRING<DD>
|
|
length of STRING
|
|
<DT id="21">+ TOKEN<DD>
|
|
interpret TOKEN as a string, even if it is a
|
|
<DT id="22"><DD>
|
|
keyword like 'match' or an operator like '/'
|
|
<DT id="23">( EXPRESSION )<DD>
|
|
value of EXPRESSION
|
|
</DL>
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
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.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Written by Mike Parker, James Youngman, and Paul Eggert.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>REPORTING BUGS</H2>
|
|
|
|
GNU coreutils online help: <<A HREF="https://www.gnu.org/software/coreutils/">https://www.gnu.org/software/coreutils/</A>>
|
|
<BR>
|
|
|
|
Report expr translation bugs to <<A HREF="https://translationproject.org/team/">https://translationproject.org/team/</A>>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
Copyright © 2018 Free Software Foundation, Inc.
|
|
License GPLv3+: GNU GPL version 3 or later <<A HREF="https://gnu.org/licenses/gpl.html">https://gnu.org/licenses/gpl.html</A>>.
|
|
<BR>
|
|
|
|
This is free software: you are free to change and redistribute it.
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
Full documentation at: <<A HREF="https://www.gnu.org/software/coreutils/expr">https://www.gnu.org/software/coreutils/expr</A>>
|
|
<BR>
|
|
|
|
or available locally via: info '(coreutils) expr invocation'
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="24"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="25"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="26"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="27"><A HREF="#lbAE">AUTHOR</A><DD>
|
|
<DT id="28"><A HREF="#lbAF">REPORTING BUGS</A><DD>
|
|
<DT id="29"><A HREF="#lbAG">COPYRIGHT</A><DD>
|
|
<DT id="30"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:12 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|