title: How to properly handle wildcard expansion in a bash shell script?
body: <pre><code>#!/bin/bash
  
  hello()
  {
      SRC=$1
      DEST=$2
  
      for IP in `cat /opt/ankit/configs/machine.configs` ; do
          echo $SRC | grep '*' &gt; /dev/null
          if test `echo $?` -eq 0 ; then
              for STAR in $SRC ; do
                  echo -en "$IP"
                  echo -en "\n\t ARG1=$STAR ARG2=$2\n\n"
              done
          else
              echo -en "$IP"
              echo -en "\n\t ARG1=$SRC ARG2=$DEST\n\n"
          fi
      done
  }
  
  hello $1 $2
  </code></pre>
  
  <p>The above is the shell script which I provide source (SRC) &amp; desitnation (DEST) path. It worked fine when I did not put in a SRC path with wild card '<em>'. When I run this shell script and give '</em>'.pdf or '*'as follows:</p>
  
  <pre><code>root@ankit1:~/as_prac# ./test.sh /home/dev/Examples/*.pdf /ankit_test/as
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>192.168.1.6
  ARG1=/home/dev/Examples/case_Contact.pdf ARG2=/home/dev/Examples/case_howard_county_library.pdf
  </code></pre>
  
  <p>The DEST is /ankit_test/as but DEST also get manupulated due to '*'. The expected answer is </p>
  
  <pre><code>ARG1=/home/dev/Examples/case_Contact.pdf ARG2=/ankit_test/as
  </code></pre>
  
  <p>So, if you understand what I am trying to do, please help me out to solve this BUG.
  I'll be grateful to you.</p>
  
  <p>Thanks in advance!!!</p>
  
  <p>I need to know exactly how I use '*.pdf' in my program one by one without disturbing DEST.</p>