Incrementing a variable is not happening

Hi All,

Iam trying to increment a variable

Following is the code

#!/usr/bin/ksh
i=1;
i='expr $i+1';
echo $i;

Output:
expr $i+1

not able to understand why its happening in that way

i was expecting result as 2... if the above method is worng .. can you help how i can get that

Needs backticks not quotes. Also, lose the semicolons.

Thanks Methyl.. It worked... BTW, Iam new to shell scripting

Please put code inside

 tags.
 
#!/usr/bin/ksh
i=1;
i='expr $i+1';

[/quote]

[indent]
With a POSIX shell, such as ksh or bash, you don't need to use an external command (such as expr) to do integer arithmetic:

i=$(( $i + 1 ))