Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
3  
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. –  user112553 Mar 22 '12 at 14:39
add comment

1 Answer

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
then
    . /dir/of/file/filename
    break # Or exit, return or whatever is necessary to avoid processing the rest of the file
fi

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

share|improve this answer
add comment

Your Answer

 
discard

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.