I have a very-long-oneliner that outputs true or false whose I want to wait to be true to process further.
My until loop works OK this way:
var=$(very-long|oneliner)
until [[ $var = true ]]; do sleep 5
var=$(very-long|oneliner); done
But when I want get it lighter:
var=$(very-long|oneliner)
until [[ $var = true ]]; do sleep 5
var=$var; done
it fails when initial $var is false because var after do is never updated as I hoped. I learned this is because at some point the loop goes in a sub shell, then var is no more the output of the oneliner, but get stuck to false. Is there a way to do it ? Maybe the first line would be declare -g var=$(very-long|oneliner) (I never used this and am afraid it spreads I don't know where in the system),or declare -x var=$(very-long|oneliner)?
Thanks in advance for hints.