given a base directory I would like to recursively list down all the header files under all directories below it /*
And if possible, I would like the output to be something like:
headerfile: <path 1>
<path 2>
...
headerfile2: <path a>
<path b> etc
Whats the best way of d开发者_运维百科oing it. I tried playing around with ls -R and grep, but i am fairly new to scripting.
find . -name "*.h"
for just the paths in the current dir and below. And if you can live with repeating the filename, and assuming I understood what you want as output, this is the more complex version...
find . -name "*.h" | while read i; do echo $(basename "$i") "$i"; done | sort
精彩评论