Sort and source configuration files from one of two directories
You can combine sort -V | uniq into sort -uV.

Note that the -V flag of sort doesn't exist in BSD.
Consider replacing it with -n if that's good enough.

The if inside the loop can be written more compactly as:

[[ -r $HOME/.myapp/$f ]] &amp;&amp; source $HOME/.myapp/$f || source /etc/myapp/$f


You could also replace source with . which is equivalent.