title: my interactive bash script loop is breaking even if I have a trap INT that should prevent it?
body: <p>on this simple script</p>
  
  <pre><code>#!/bin/bash -i
  trap 'echo "(ctrl+c was hit)"' INT
  while true; do
      echo -n "hit Enter..";read
      echo "still on loop"
  done
  </code></pre>
  
  <p>if I hit ctrl+c it will exit the loop</p>
  
  <p>if I make it not interactive with 1st line like <code>#!/bin/bash</code>, it will work!</p>
  
  <p>the problem is I have several scripts (run with "startup applications" stored at <code>~/.config/autostart</code>) that only work properly with interactivity enabled <code>#!/bin/bash -i</code>, mainly because they load the <code>.bashrc</code> again granted by <code>-i</code> option.</p>
  
  <p>any tips?</p>
  
  <p>EDIT: I found this on the begging of my <code>~/.bashrc</code> file:</p>
  
  <pre><code># If not running interactively, don't do anything
  case $- in
      *i*) ;;
        *) return;;
  esac
  </code></pre>
  
  <p>that prevents loading that file as source in non interactive script, I didnt put it there and I dont know why it is there...</p>
  
  <p>EDIT: so, as the problem is loading what is setup at <code>~/.bashrc</code>, but to the script doesnt behave weirdly, I found that scripts started by "startup applications" stored at <code>~/.config/autostart</code>, may be run this way:</p>
  
  <pre><code>xterm -e "bash -i -c myScript.sh"
  #or
  bash -i -c 'xterm -e "myScript.sh"' #this way the title looks better
  </code></pre>
  
  <p>so the script wont have <code>-i</code> option, will begin just with <code>#!/bin/bash</code> to behave properly, and the <code>~/.bashrc</code> file will setup the environment properly also.</p>