My requirement is as follows,

```
if cond1 is true; then
    if [[ val1 -lt val2 ]]; then
        call_x_func
        call_y_func
        call_z_func
    fi
else
    if [[ val1 != val2 ]]; then
        call_x_func
        call_y_func
        call_z_func
    fi
fi

```

From above you can see that if cond1 is true then use operator -lt or else use !=. contents inside the loop remains the same. To acheive this, I am trying to do below but not able to assign bool value to bash variable. What would be the best way of doing this ?

```
need_change=false
if cond1; then
    need_change=[[ val1 -lt val2 ]]
else
    need_change=[[ val1 != val2 ]] 
fi

if $need_change; then
    call_x_func
    call_y_func
    call_z_func
fi

```