import os
path = "a/b/c/abc.txt"
print os.path.splitext(os.path.basename(path))[0]
Try:
readlink `which lynx`
which
does not follow symbolic links. Instead, it gets only to the symbolic link which got executed. readlink
can then follow this symbolic link to the original binary/executable.
Also:
ls -l `which lynx`
which will exhibit the linked path (at least on some ls
s).