title: How do I get the script name being executed in bash?
body: <p>So I am trying to make a portable bashrc/bash_profile file. I have a single script that I am symbolically linking to .bashrc, .bash_profile, etc. I am then looking at <code>$0</code> and switching what I do based on which script was called. The problem is what the shell calls the bashrc script of course it executes bash really which means <code>$0</code> for me is <code>-bash</code>. <code>$1</code> further more is not set to the script name.</p>
  
  <p>So my question is, in bash how can I get the name of the script being executed. Not the binary executing it, e.g. bash?</p>
  
  <p>I assume its giving me <code>-bash</code> with <code>$1</code> not being set because it is really not a new process. Any ideas?</p>