while never ends

Hi

i have question, is this ok in ksh, like

while [[ $true != y || $true != Y ]]
do
something
read true
done

loop runs but never ends even i pass y/Y.
can any body please resolve it

Absolutely no idea why it works like this. I sense the problem is with the multiple conditions

[[ $true != y || $true != Y ]]

Instead you could have one condition as below

while [[ $true !=  "Y" ]]
do
echo "Doing Something"
read true
true=`echo $true|tr [a-z] [A-z]`
done

yaa

[[.......]] alone or as if [[ ....]] is working but with while it never works for me .any way thanks for reply.

Your test condition is always going to be true.

If you enter 'y' for the $true variable then "$true != 'Y'" will be true, if you enter 'Y' for the $true variable then "$true != 'y'" will be true. You need to change || to &&.

Cheers

In addition to what grasper already said: I would change the variables name from "true" to something else, like "continuation_flag" or whatever. "true" is a command and you should not name variables the same.

bakunin