Expr - Related Links
Open Access Articles- Top Results for Expr
Cell & Developmental BiologySilencing miR-16 Expression Promotes Angiotensin II Stimulated Vascular Smooth Muscle Cell Growth
Journal of Stem Cell Research & TherapyHyaluronic Acid Mediated Enrichment of CD44 Expressing Glioblastoma Stem Cells in U251MG Xenograft Mouse Model
Entomology, Ornithology & Herpetology: Current ResearchUnderstanding the Mechanisms Involved in the Regulation of Cytochrome P450 Gene Expression in Drosophila melanogaster (Diptera: Drosophilidae)
Journal of Clinical & Experimental PharmacologyGastroprotective Effect of Vanillin on Indomethacin-Induced Gastric Ulcer in Rats: Protective Pathways and Anti-Secretory Mechanism
Journal of Brain Tumors & NeurooncologyCritical Role of a Novel Biological Marker GALNT14 Expression in Different Cancer Types
expr is a command line Unix utility which evaluates an expression and outputs the corresponding value. It first appeared in Unix v7 as a standalone program, and was later incorporated into the shell as a built-in command.
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 invoking 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 regular expression, find a set of characters in a string; in some versions: find substring, length of string
- for either: comparison (equal, not equal, less than, etc.)
The following is an example involving boolean expressions:
expr length "abcdef" "<" 5 "|" 15 - 4 ">" 8
This example outputs "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.
For pure arithmetic, it is often more convenient to use bc. For example:
echo "3*4+14/2" | bc
since it accepts the expression as a single argument.
For portable shell programming use of the length and substr commands is not recommended.
- The Single UNIX® Specification, Issue 7 from The Open Group : evaluate arguments as an expression – Commands & Utilities Reference,
- expr invocation in GNU coreutils manual
Lua error in package.lua at line 80: module 'Module:Buffer' not found.