I have tried countless ways to get what I want, but nothing seems to work. I always end up with something like `2:not found`.

I want to capture the output of a command, and then test if it equals "!", like so:

```
function test() {
  local testv=$(command) 2>/dev/null
  if [ $(#testv) == "!" ]; then
    echo "Exclamation mark!"
  else
    echo "No exclamation mark."
  fi
}

```

How should I rewrite the code above to avoid the error `test:2: = not found`?