title: Bash For-Loop on Directories
body: <p>Quick Background:</p>
  
  <pre><code>$ ls src
  file1  file2  dir1  dir2  dir3
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>#!/bin/bash
  
  for i in src/* ; do
    if [ -d "$i" ]; then
      echo "$i"
    fi
  done
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>src/dir1
  src/dir2
  src/dir3
  </code></pre>
  
  <p>However, I want it to read:</p>
  
  <pre><code>dir1
  dir2
  dir3
  </code></pre>
  
  <p>Now I realize I could sed/awk the output to remove "src/" however I am curious to know if there is a better way of going about this. Perhaps using a find + while-loop instead. </p>