How do you increment a variable in UNIX?

Trung Minh

New member
How do you increment a variable in UNIX?
Answer
From within a shell script you use expr to increment a variable by assigning the output of expr to the variable:
N=`expr $N + 1` Increment N by one.
 

Tìm kiếm

Back
Top