title: Passing arguments to /bin/bash via a bash script
body: <p>I am writing a bash script that takes a number of command line arguments (possibly including spaces) and passes all of them to a program (/bin/some_program) via a login shell.  The login shell that is called from the bash script will depend on the user's login shell.  Let's suppose the user uses /bin/bash as their login shell in this example... but it might be /bin/tcsh or anything else.</p>
  
  <p>If I know how many arguments will be passed to some_program, I can put the following lines in my bash script:</p>
  
  <pre><code>#!/bin/bash
  # ... (some lines where we determine that the user's login shell is bash) ...
  /bin/bash --login -c "/bin/some_program \"$1\" \"$2\""
  </code></pre>
  
  <p>and then call the above script as follows:</p>
  
  <pre><code>my_script "this is too" cool
  </code></pre>
  
  <p>With the above example I can confirm that some_program receives two arguments, "this is too" and "cool".</p>
  
  <p>My question is... what if I don't know how many arguments will be passed?  I'd like to pass all the arguments that were sent to my_script along to some_program.  The problem is I can't figure out how to do this.  Here are some things that <em>don't work</em>:</p>
  
  <pre><code>/bin/bash --login -c "/bin/some_program $@"     # --&gt; 3 arguments: "this","is","too"
  /bin/bash --login -c /bin/some_program "$@"     # --&gt; passes no arguments
  </code></pre>