[Bash]Function returning a boolean

Hello all,

I would like to know if it is possible to return a the result of a boolean expression from a function like this

function()
{
  # some code
  return [ $nb1 -lt 100 ] || [ $nb2 -lt 100 ]
}

and what will be the return value ?

Thank you for help.

func()
{
  # ...
  [ $nb1 -lt 100 ] || [ $nb2 -lt 100 ]
}

The return code will be 0 (=success) if either nb1 or nb2 is less than 100.

Alright thank you. I have another question though, now that i have my result is it possible to use it in another test in this way :

function_boolean
bool=$?
while [ $bool ] && [ boolean expression ]; do
  # ...
done

Did you try it?

Did it work?

bool=$?
while [ $bool ] 

this will always be true. so you may want to compare like $bol > 0 or $bol =0 or something as you want.

bool=$?
while [[ $bool > 0 &&  true ]]; do
  # ...
done

cheers,
Devaraj Takhellambam

Yes it tried, but didnt work the way i want, but i dont know where i m wrong even i m echoing some values.

Alright its working now that i add the comparison operator.
Thanks guys.