Escape the dollar sign ( \$).
> sh -c "DOG=happy; echo \$DOG;"
happy
Another option is to use single quotes instead of double quotes - variables are not evaluated inside single quotes, so they $DOGwill be passed in shfor evaluation.
> sh -c 'DOG=happy; echo $DOG'
happy
, sh, , , .