I have some folders specified in my PATH environment variable. How do I list all the files in these folders?
You can use this pipeline with any necessary modifications applied:
<<<"$PATH" sed 's/:/\n/g' | xargs -I@ find "@" -name '*a*'
-name '*a*' with any filters you need. If you don't need to apply filters, etc, you can use the short version for the
xarg part of the pipeline:
xargs find, ie.:
<<<"$PATH" sed 's/:/\n/g' | xargs find
sed part can in fact be reduced to a here string and delimiter definition as in:
<<<"$PATH" xargs -d: find