title: Get last parameter on shell script
body: <p>case 1 : 
  suppose I am passing a number of parameters to my shell script as follows :</p>
  
  <pre><code>./myshell_script a b c d 
  </code></pre>
  
  <p>and if I run <code>echo $#</code> will give me number of parameters from command line I have passed and I stored it in a variable like [ since I dont know number of arguments a user is passing ]:</p>
  
  <pre><code>var1 = `echo "$#"`
  </code></pre>
  
  <p>case 2 :
  $4 gives me the name of last argument .</p>
  
  <p>if i want it to store in </p>
  
  <p>var2 then</p>
  
  <pre><code>var2 = $4 
  </code></pre>
  
  <p>My question is :</p>
  
  <p>If I want to store value I get from var1 to var2 directly , how would be it possible in shell script ?</p>
  
  <p>for ex :</p>
  
  <pre><code>./myshell_script.sh a b c
  
  var1 = `echo "$#"` ie var1 = 3
  </code></pre>
  
  <p>now I want</p>
  
  <p>var2 = c [ ie always last parameter , since I dont know how many number of parameters user is passing from comand line ] </p>
  
  <p>what I have to do ?</p>