Sams Teach Yourself Shell Programming in 24 Hours (Email web hosting)
Wednesday, October 31st, 2007Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 18: Miscellaneous Tools Previous Chapter Next Chapter Sections in this Chapter: The eval Command The expr Command The : Command The bc Command The type Command remsh/rsh/rcmd/remote (Remote Shell) The sleep Command Summary The find Command Questions xargs Terms Previous Section Next Section The expr Command The expr command performs simple integer arithmetic: $ expr 8 / 3 2 $ Notice that any fractional result is ignored. The general syntax is expr integer1 operand integer2 Possible operands are given in Table 18.3. Table 18.3 expr Operands Operand Description + Addition - Subtraction * Multiplication / Integer division (any fraction in the result is dropped) % Remainder from a division operation (also called the modulus function) Notice that the * sign must be quoted to prevent shell expansion (see Chapter 9), but the spaces around the * sign must not be quoted: $ expr 3 * 5 15 $ The remainder or modulus function is what remains after a division operation: $ expr 19 % 7 5
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.