This was enough for me to get a list of all exported variable names that handled quoted and multi-lined values:
export | egrep ^declare | cut -d= -f1 | cut -d' ' -f3 As Stephane pointed out, this works in bash, and you'd be better using compgen -e which is bash-only. If you want a 1-liner that works the same in bash, dash and zsh, you can use this instead:
export | egrep '^(declare|export)' | sed -E 's/(^declare -x |export )//' | cut -d= -f1 | cut -d' ' -f2 ... although this won't work for multi-line values in dash.