title: bash - how to process exit code when using set -e and get output of command
body: <p>I have <code>set -e</code> at top of script. How to avoid script termination for some commands and process exit code? I have a difficulty in following code sample:<br>
  I need both output to variable and exit code, without <code>set -e</code> its easy.</p>
  
  <pre><code>set -e
  ...
  formoutput=$(yad --form --field="Subdomain" --field="Domain" --field="Web master username" \
    --field="Apache group" --field='Webroot' \
    --field='Webroot variables - ${homedir}(of webmaster) ${subdomain} ${webmaster} ${domain}:LBL' \
    --field="Virtualhost ip or domain" \
    --field="Virtualhost port" --field="Server admin email" \
    --field="Create mysql user&amp;db:CHK" \
    --button="Cancel:3" --button="Save defaults:2" --button="Create:0" \
    --title="Create apache virtualhost" \
    --text='Subdomain are case sencetive for Webroot folder ${subdomain} variable' \
    --focus-field=1 --center --window-icon="preferences-system" --width=600 \
    "${config[subdomain]}" "${config[domain]}" "${config[webmaster]}" "${config[webgroup]}" \
    "${config[webroot]}" "test" "${config[virtualhost]}" "${config[virtualport]}" "${config[serveradmin]}" 1)
  formbutton="$?"
  </code></pre>