cfg/bin/short_path
2016-07-21 16:29:54 +02:00

18 lines
346 B
Python
Executable file

#!/usr/bin/env python
import os
path = os.getcwd()
path = path.replace(os.environ["HOME"], "~")
path_parts = path.split("/")
path = ""
for part in path_parts[:-2]:
if len(part) > 0:
path = "{}/{}".format(path, part[0])
else:
path = "{}/{}".format(path, part)
path = "{}/{}".format(path, "/".join(path_parts[-2:]))
print path[1:]