in C I can assign a value in this way:
val = (cond)? val_true : val_false;
and it's equivalent to
if (cond) 
    val = val_true;
else
    val = val_false;
Are there an equivalent of val=(cond)? val_true : val_false in shell bash?
in C I can assign a value in this way:
val = (cond)? val_true : val_false;
and it's equivalent to
if (cond) 
    val = val_true;
else
    val = val_false;
Are there an equivalent of val=(cond)? val_true : val_false in shell bash?
 
    
    Suppose you want it to be somewhat like this:
true=1
[ $true ] && p=1 || p=0
All you have to do is keep whatever condition you want within those brackets.
If it’s valid, then the branch after the AND is followed, otherwise that after the OR is followed.
This is equivalent to this:
if [ $true ]; then p=1; else p=0; fi
So you should be aware of the construct in case you ever run into it, but it’s arguably less readable than just listing out explicitly what you’re doing.