GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing en.wikipedia.org — expr - Wikipedia
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,[1] and for Windows via UnxUtils.[2][3] ExampleThe following is a (non-POSIX-compliant) 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. PortabilityFor portable shell programming, use of the "index", "length", "match" and "substr" commands must be avoided; string matching remains possible but it must use the "string : regexp" syntax. See alsoReferences
External linksThe Wikibook Guide to Unix has a page on the topic of: Commands
Retrieved from "https://en.wikipedia.org/w/index.php?title=Expr&oldid=1353507394" | ||||||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | ||||||||||||||||