darkrc/bin/gitpath

12 lines
206 B
Bash
Executable file

#!/bin/sh
top=$(git rev-parse --show-toplevel 2>/dev/null | sed -e 's/\//\\\//g')
if [ -n "$top" ]
then
path=$(pwd -P | sed -e "s/^$top//")
if [ ! -z "$path" ]
then echo -n "$path "
fi
else
exit 1
fi