title: Pass parameter from Local to Sudo user
body: <p>Ok if subject is not clear i will explain my doubt.I have a shell script kept at my local user called (<strong>executeAdM.sh</strong>), and when i execute this script i am connecting to <strong>SUDO user</strong> by taking commands from instruction file.But when i execute this script i am also passing <strong>parameter</strong> to this script which is actually some <strong>directory path</strong> of SUDO user. See the script below-:</p>
  
  <p>Script at local(executeADM.sh) -:</p>
  
  <pre><code>#!/bin/bash
  echo password | sudo -S -l
  sudo /usr/bin/su - user  &lt;&lt;\EOF
  #ls -lrt
  pwd
  for entry in $(ls -r)
    do
    if [ "$entry" = "testingADM.sh" ];then
  ./$entry $1
  fi
  done
  EOF
  </code></pre>
  
  <p>Executing Above as-:</p>
  
  <pre><code>./executeADM.sh somePath
  </code></pre>
  
  <p>When above script executes it connects successfully to another user, and at <strong>SUDO user</strong>  i execute a for loop which search for another SCRIPT called <strong>testingADM.sh</strong> . Once the script is found i execute that script with parameter passed from Local User and  <strong>testingADM.sh</strong> should set that path for me which is not working it is not reading prameter passed from local user.Can anyone help me here i am not getting how to solve this. Please ask me if anything is not clear basically i want to pass parameter from <strong>LOCAL</strong> shell script to <strong>SUDO USER</strong> shell script-:</p>
  
  <p>SUDO user script (<strong>testingADM.sh</strong>)-:</p>
  
  <pre><code>#!/bin/bash
  path=$1
  cd $path
  pwd
  </code></pre>
  
  <p>If i hard code path variable value in script kept at SUDO all works fine . But i don't want that.:</p>
  
  <pre><code> #!/bin/bash
   path=somepath
   cd $path
   pwd
  </code></pre>