19 lines
346 B
Text
19 lines
346 B
Text
|
#!/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:]
|