-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathabspath
More file actions
executable file
·26 lines (18 loc) · 755 Bytes
/
Copy pathabspath
File metadata and controls
executable file
·26 lines (18 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python
# this file is part of the nil0x42's git repositories
# for the current version, take a look at:
# https://bitbucket.org/nil0x42/scripts
# Print the absolute path of the specified file
# Usage: abspath <relative-path>
# Note that the python's os.path.realpath() function is used, making
# the script show the real path of the given argument, translating
# eventual unix symbolic links.
# PS: If an unexisting file is given as argument, the realpath of the
# file if it existed if given istead of returning and error, this
# is not a mistake from me, but a voluntarily caused behavior due
# to my personal use.
from sys import argv
from os.path import realpath
try: arg = argv[1]
except: arg = ''
print(realpath(arg))