Ok, found a solution. It was to move the logic outside of the bash code.
parameters:
- name: strValue
steps:
- task: Bash@3
condition: ${{ eq(parameters.strValue, 'valueX') }}
displayName: 'Do stuff'
inputs:
targetType: inline
script: |
...