Lesson plan

Expr

expr is a shell command that evaluates an expression and outputs the result. It evaluates integer or string expressions, including pattern matching regular expressions. Comparison operators (equal, not equal, less than, etc.) apply to both integer and string values. Integer-specific operations include addition, subtraction, multiplication, division and modulus. String-specific operators include: * matching a regular expression ( , or the colon syntax for an arbitrary string "str" and regular expression "reg") * finding a set of characters in a string ( ) * finding a substring ( ) * finding the length of a string ( ) Each symbol (operator, value, etc.) in the expression must be given as a separate parameter. A common challenge with using the command is preventing the shell from acting on input indented to be the expression as something other than expression. Originally developed for Unix v7 and standardized by POSIX, the command is available on IBM i, and for Windows via UnxUtils.

Back to article

Article summary

expr is a shell command that evaluates an expression and outputs the result. It evaluates integer or string expressions, including pattern matching regular expressions. Comparison operators (equal, not equal, less than, etc.) apply to both integer and string values. Integer-specific operations include addition, subtraction, multiplication, division and modulus. String-specific operators include: * matching a regular expression ( , or the colon syntax for an arbitrary string "str" and regular expression "reg") * finding a set of characters in a string ( ) * finding a substring ( ) * finding the length of a string ( ) Each symbol (operator, value, etc.) in the expression must be given as a separate parameter. A common challenge with using the command is preventing the shell from acting on input indented to be the expression as something other than expression. Originally developed for Unix v7 and standardized by POSIX, the command is available on IBM i, and for Windows via UnxUtils.

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.