#!/bin/bash
s='# comment
     # comment
dog=woof
cat=meow
moose=huuuuu #comment

# comment
### comment'
awk -F'=' '!/^[[:space:]]*#/{print $1}' <<< "$s"