Expr

Expr

expr is a command line Unix utility which evaluates an expression and outputs the corresponding value.

Syntax: expr "(expression)"

"expr" evaluates integer or string expressions, including pattern matching regular expressions. Most of the challenge posed in writing expressions is preventing the command line shell from acting on characters intended for "expr" to process.

The operators available
* for integers: addition, subtraction, multiplication, division and modulus
* for strings: find substring, find regular expression, find a set of characters in a string, length of string
* for either: comparison (equal, not equal, less than, etc.)Also, boolean expressions involving "and" and "or", such as expr length "abcdef" "<" 5 "|" 15 - 4 ">" 8outputs "1". This is because length "abcdef" is 6, which is not less than 5 (so the left side of the | returns zero). But 15 minus 4 is 11 and is greater than 8, so the right side is true, which makes the "or" true, so 1 is the result. The program exit status is zero for this example.

External links

* [http://www.linuxmanpages.com/man1/expr.1.php The program's manpage]

* [http://www.gnu.org/software/coreutils/manual/html_node/expr-invocation.html#expr-invocation expr invocation in GNU coreutils manual]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Expr — ist ein Befehl auf dem Betriebssystem Unix und seinen Derivaten, welches einen Ausdruck auswertet und das Ergebnis ausgibt. expr verarbeitet Ausdrücke mit Integerwerten oder Zeichenketten sowie auch Regulären Ausdrücken. Der Befehl wird im… …   Deutsch Wikipedia

  • Expr — программа в UNIX‐подобных ОС, вычисляющая значение выражения и выводящая результат на стандартный вывод. Каждая лексема выражения должна быть отдельным аргументом. Операнды могут быть как числами, так и строками. Строковые операнды не надо… …   Википедия

  • expr — программа в UNIX‐подобных ОС, вычисляющая значение выражения и выводящая результат на стандартный вывод. Каждая лексема выражения должна быть отдельным аргументом. Операнды могут быть как числами, так и строками. Строковые операнды не надо… …   Википедия

  • expr — ist ein Befehl auf dem Betriebssystem Unix und seinen Derivaten, welches einen Ausdruck auswertet und das Ergebnis ausgibt. expr verarbeitet Ausdrücke mit Integerwerten oder Zeichenketten sowie auch Regulären Ausdrücken. Der Befehl wird im… …   Deutsch Wikipedia

  • Expr — est un programme Unix qui permet d évaluer des expressions et de les afficher à l écran. Ce programme fait partie du paquetage coreutils. Lien externe (fr) Le Man expr Commandes Unix …   Wikipédia en Français

  • expr — est un programme Unix qui permet d évaluer des expressions, notamment pour faire des opérations arithmétiques ou des comparaisons de chaînes de caractères, et de les afficher à l écran. Sur un système d exploitation GNU, expr fait partie du… …   Wikipédia en Français

  • Expr (Unix) — expr expr est un programme Unix qui permet d évaluer des expressions et de les afficher à l écran. Ce programme fait partie du paquetage coreutils. Lien externe (fr) Le Man expr Commandes Unix …   Wikipédia en Français

  • Expr. — Express EN express …   Abkürzungen und Akronyme in der deutschsprachigen Presse Gebrauchtwagen

  • expr. — expressiv EN expressive …   Abkürzungen und Akronyme in der deutschsprachigen Presse Gebrauchtwagen

  • expr. — abbr. expressing, expressive of …   Dictionary of abbreviations

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”