Quick Background:
$ ls src
file1 file2 dir1 dir2 dir3
Script:
#!/bin/bash
for i in src/* ; do
if [ -d "$i" ]; then
echo "$i"
fi
done
Output:
src/dir1
src/dir2
src/dir3
However, I want it to read:
dir1
dir2
dir3
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.