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


let

let expressions
     or
(( expressions ))

Korn shell only. Perform arithmetic as specified by one or more 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 chapter. See also expr in Chapter 2 .

Examples

Each of these examples adds 1 to variable i :

i=`expr $i + 1`	sh, ksh88, ksh93

let i=i+1		ksh88 and ksh93

let "i = i + 1"
(( i = i + 1 ))
(( i += 1 ))
(( i++ ))		ksh93 only


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

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