Skip to content

Instantly share code, notes, and snippets.

@satorg
Last active June 14, 2021 18:49
Show Gist options
  • Save satorg/00222020ac073f843332533527188631 to your computer and use it in GitHub Desktop.
Save satorg/00222020ac073f843332533527188631 to your computer and use it in GitHub Desktop.
Portable realpath script implementation in Python3
#!/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