Last active
June 14, 2021 18:49
-
-
Save satorg/00222020ac073f843332533527188631 to your computer and use it in GitHub Desktop.
Portable realpath script implementation in Python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from argparse import * | |
import pathlib | |
import os | |
parser = ArgumentParser( | |
description='follow a symlink recursively.' | |
) | |
parser.add_argument( | |
'file', | |
type=pathlib.Path, | |
help='path to the symlink' | |
) | |
args = parser.parse_args() | |
print(os.path.realpath(args.file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment