title: Set environment variables for non-interactive shell
body: <p>I'm trying to set environment variables for non-interactive non-login shell. I know bash reads the contents of ~/.bashrc before execute the command. In the beginning of the script there's a part:</p>
  
  <pre><code>*# If not running interactively, don't do anything
  
  case $- in
  *i*) ;;
    *) return;;
  esac*
  </code></pre>
  
  <p>So I think if I add something above it, it will take effect no matter if the shell is interactive or not:</p>
  
  <pre><code>export VAR=something
  
  # If not running interactively, don't do anything
  
  case $- in
  *i*) ;;
    *) return;;
  esac
  </code></pre>
  
  <p>However it doesn't work :(. I want to avoid using $BASH_ENV because it messes up my xkb settings. I remapped some keys in /usr/share/X11/xkb/symbols/pc. And if I set $BASH_ENV, it will just loads the default keymap.</p>