How to get relative path from two absolute paths in linux shell?

Posted by Zebooka on Super User See other posts from Super User or by Zebooka
Published on 2010-05-13T03:56:57Z Indexed on 2010/05/13 4:34 UTC
Read the original article Hit count: 336

Filed under:
|
|
|
|

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)

© Super User or respective owner

How to get relative path from two absolute paths in linux shell?

Posted by Zebooka on Stack Overflow See other posts from Stack Overflow or by Zebooka
Published on 2010-05-13T03:56:57Z Indexed on 2010/05/13 4:04 UTC
Read the original article Hit count: 336

Filed under:
|
|
|
|

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)

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell