I'm trying to write in bash what would look like this in PHP 7:
echo ${$branch . '_SSH'} ?? $default_SSH;
- Check for a variable which has a variable name.
- Fall back to another variable if it doesn't exist.
- echo the result.
Is there an equivalent one liner in bash?
Thanks for the input. This doesn't kill it 100%. It checks if
$BRANCH
exists but not if the variable${$BRANCH'_SSH'}
exists.