I have several cases where I would like to concatenate two directories.

eg. there is a dir /etc/profile.d and I have a dir /wa1/profile_local.d that contains files that define local aliases and functions. Right now I copy the contents of profile_local.d to profile.d whenever I install a new system or set up a new machine. Is there any way that I can simply make the local dir appear as an extension of /etc/profile.d? That is, get the same result as if I copied the contents of my local dir to /etc/profile.d?

  • 3
    You could have a look at union filesystems – Stéphane Chazelas Mar 3 at 0:21
  • 3
    Just to provide more insight into the specifics, tell us how making links, (symbolic links if you're crossing file systems) from one directory to the other does not address your needs (e.g. cd /etc/profile.d; ln -s /wa1/profile_local.d/* . ) – Theophrastus Mar 3 at 0:42
  • @Stéphane Chazelas Thanksfor the suggestion. I'll look into that. – Gramps Mar 3 at 15:13
  • @Theophrastus Thanks! I've never seen ln used like that. That will solve the problem until I get unionfs figured out. The only shortcoming with ln is that when I add files to /wa1/profile_local.d they won't show up in /etc/profile.d until I create a corresponding soft link. – Gramps Mar 3 at 15:18
  • @Gramps well of course you could make one of those directories (and not merely their contents) a symbolic link to the other and then they would (being a view to one and the same) appear to auto-sync. but beware of making system important directories (like /etc/profile.d) dependent on a separate mount status – Theophrastus Mar 3 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.