Skip to content

Instantly share code, notes, and snippets.

@hercynium
hercynium / relpath.bash
Created October 16, 2012 13:51 — forked from netj/relpath
A Bash script providing a command for computing relative path between two filesystem paths
#!/bin/bash
# relpath -- Compute relative path from a given DIR to given PATHs
# Usage: relpath DIR PATH...
#
# Example: relpath /a/b/c /a/d/e/f
# prints: ../../d/e/f
#
# Example: relpath /a/b/c /
# prints: ../../../
#