We have two paths. First one is directory, second either dir or file.

/a/b/c and /a/d/e.txt

Relative path from first path to second will be: ../../d/e.txt

How to get it in linux terminal?

PS: For those who ask "what is use case?" - creating lots of relative symlinks (just as an example)

link|improve this question
1  
This should not have been migrated. – Roger Pate May 13 '10 at 4:52
It should have been closed as a duplicate. – Dennis Williamson May 13 '10 at 10:19
feedback

migrated from stackoverflow.com May 13 '10 at 4:30

This question came from our site for professional and enthusiast programmers.

1 Answer

Looks like this type of problem was discussed in

http://stackoverflow.com/questions/2564634/bash-convert-absolute-path-into-relative-path-given-a-current-directory

link|improve this answer
Thank you - saves me looking up the discussion. – Jonathan Leffler May 13 '10 at 4:49
feedback

Your Answer

 
or
required, but never shown