Seth Woolley's Man Viewer

Manual for expr - man 1 expr

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

EXPR(1)                          User Commands                         EXPR(1)



NAME
       expr(1,3,n) - evaluate expressions

SYNOPSIS
       expr(1,3,n) EXPRESSION
       expr(1,3,n) OPTION

DESCRIPTION
       --help display this help and exit(3,n,1 builtins)

       --version
              output version(1,3,5) information and exit(3,n,1 builtins)

       Print  the  value of EXPRESSION to standard output.  A blank line below
       separates increasing precedence groups.  EXPRESSION may be:

       ARG1 | ARG2
              ARG1 if(3,n) it is neither null nor 0, otherwise ARG2

       ARG1 & ARG2
              ARG1 if(3,n) neither argument is null or 0, otherwise 0

       ARG1 < ARG2
              ARG1 is less(1,3) than ARG2

       ARG1 <= ARG2
              ARG1 is less(1,3) than or equal to ARG2

       ARG1 = ARG2
              ARG1 is equal to ARG2

       ARG1 != ARG2
              ARG1 is unequal to ARG2

       ARG1 >= ARG2
              ARG1 is greater than or equal to ARG2

       ARG1 > ARG2
              ARG1 is greater than ARG2

       ARG1 + 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(1,8) STRING

       match STRING REGEXP
              same as STRING : REGEXP

       substr STRING POS LENGTH
              substring of STRING, POS counted from 1

       index STRING CHARS
              index in(1,8) STRING where any CHARS is found, or 0

       length STRING
              length of STRING

       + TOKEN
              interpret TOKEN as a string(3,n), even if(3,n) it is a

              keyword like `match' or an operator like `/'

       ( EXPRESSION )
              value of EXPRESSION

       Beware that many operators need to be escaped  or  quoted  for  shells.
       Comparisons are arithmetic if(3,n) both ARGs are numbers, else lexicographi-
       cal.  Pattern matches return the string(3,n) matched between \(  and  \)  or
       null;  if(3,n)  \( and \) are not used, they return the number of characters
       matched or 0.

AUTHOR
       Written by Mike Parker.

REPORTING BUGS
       Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT
       Copyright  2004 Free Software Foundation, Inc.
       This is free software; see the source for copying conditions.  There is
       NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
       PURPOSE.

SEE ALSO
       The full documentation for expr(1,3,n) is maintained as a Texinfo manual.   If
       the  info(1,5,n)  and  expr(1,3,n)  programs are properly installed at your site, the
       command

              info(1,5,n) coreutils expr(1,3,n)

       should give you access(2,5) to the complete manual.



expr(1,3,n) 5.2.1                        March 2004                           EXPR(1)

References for this manual (incoming links)