home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: kill Chapter 4
The Bourne Shell and Korn Shell
Next: Reference: newgrp









Korn shell only. Perform arithmetic as specified by one or more integer expressions . expressions consist of numbers, operators, and shell variables (which don't need a preceding $ ). Expressions must be quoted if they contain spaces or other special characters. The (( )) form does the quoting for you. For more information and examples, see "Arithmetic Expressions" earlier in this section. See also expr in Section 2.


Each example below adds 1 to variable i .

i=`expr $i + 1`
let i=i+1
let "i = i + 1"
(( i = i + 1 ))

Previous: Reference: kill UNIX in a Nutshell: System V Edition Next: Reference: newgrp
Reference: kill Book Index Reference: newgrp

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System