title: How to loop over a list of directories containing wildcards in bash?
body: <p>Assuming that I have a directory which contains decades of subdirectories:</p>
  
  <pre><code>$ ls -d /very/long/path/*/
  adir1/ adir2/ b2dir/ b3dir/ k101/ k102/ k103/ k104/ k220/ k221/ k222/ etc
  </code></pre>
  
  <p>I would like to loop over a selection of directories which will be defined "dynamically" based on the answer given by the user and it will contain wildcards. For example (the code that doesn't work):</p>
  
  <pre><code>$ cat my_script.sh
  
  DATADIR="/very/long/path"
  echo -n "Select dirs to involve: "
  read dirlist
  for DIR in "$dirlist"; do
    echo $DATADIR/$DIR 
    [do stuff]
    ...
  done
  </code></pre>
  
  <p>What would be desired is the following:</p>
  
  <pre><code>$ ./my_script.sh
  Select dirs to involve: a* k10?
  
  /very/long/path/adir1
  /very/long/path/adir2
  /very/long/path/k101
  /very/long/path/k102
  /very/long/path/k103
  /very/long/path/k104
  </code></pre>
  
  <p>Any hint?</p>