the code is given as

#!/bin/sh

i=1;
while [ $i -le 5 ]
do
echo "welcome $i times";
i= 'expr $i + 1 ';
done


it enters into infinite loop and does not increment the i variable plz suggest something

exit 0;

Recommended Answers

All 2 Replies

What does it print out between "welcome" and "times"?

And post your code again, using code tags, as I can not tell what quote you are using around your expr statement (and it makes a difference).

Hey there,

It's hard to tell without code tags, but it looks like you might be using regular ticks when you should be wrapping your expr expression in backticks.

Cheers,

, Mike

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.