title: Adapting "module" alias (invoking modulecmd) from tcsh to bash
body: <p>In tcsh, I can run commands like:</p>
  
  <pre><code> module add jdk/1.8.0_162 
  </code></pre>
  
  <p>...using an alias defined as such:</p>
  
  <pre><code>alias module 'eval `/app/modules/0/bin/modulecmd tcsh \!*`'
  </code></pre>
  
  <p>I'm trying to get an equivalent to this for bash.</p>
  
  <hr>
  
  <p>Currently, I've tried making a separate bash function for each subcommand, like so:</p>
  
  <pre><code>function module_add {
      /app/modules/0/bin/modulecmd bash add $1 2&gt;&gt;err.log
  }
  
  function module_rm {
      /app/modules/0/bin/modulecmd bash rm $1 2&gt;&gt;err.log
  }
  
  function module_list {
      /app/modules/0/bin/modulecmd bash list
  }
  
  java -version
  module_list
  module_rm 'j2re'
  module_add 'jdk/1.8.0_162'
  module_add 'gtk+/2.24.17'
  module_list
  java -version
  </code></pre>
  
  <p>I can be sure the program calls have been executed, since the unexisting module (added by purpose for testing) gtk+/2.24.17 creates an entry in err.log.</p>
  
  <p>However, java -version still shows the same older version and module_list does not show any new modules. Everything works great in tcsh (where I use the module add alias instead). I have tried different versions of module command. The latest version tested is 3.2.10. The result is the same on RHEL6 and RHEL7</p>
  
  <p>Any ideas how to solve this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Based on some clever comments I tried to the exact same command for tcsh</p>
  
  <pre><code>/app/modules/0/bin/modulecmd tcsh add jdk/1.8.0_162
  </code></pre>
  
  <p>and it gave the same result. Anyone who knows the difference between that command and</p>
  
  <pre><code>module add jdk/1.8.0_162 
  </code></pre>
  
  <p>in tcsh?</p>
  
  <p>So I guess the question is rather about how the modulescmd differ from the tcsh alias <code>module add</code></p>
  
  <p>BR
  Patrik</p>