Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my configuration file (e.g. .zshrc) put into an encfs container. When I log into the system the container is not yet mounted, hence the the symlink is dangling then. Is there a way to let the symlink to point to two locations, so if one is not present it uses the other?

share|improve this question
That isn't possible AFAIK, but you could set it to the "default" location on login and start a background job that waits for the encfs container to become available, then overwrite the symlink and exit. – peth Mar 22 '12 at 14:39
up vote 1 down vote accepted

I don't think this is possible, but there's an alternative way to achieve the same effect (sh syntax; should work in zsh as well):

if ! find -L /dir/of/file -mindepth 1 -maxdepth 1 -type l -name filename
    . /dir/of/file/filename
    break # Or exit, return or whatever is necessary to avoid processing the rest of the file

In other words, if the symlink is not broken, use that, otherwise continue in this file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.