How to get the absolute path for a given relative path programmatically in Linux?

后端 未结 7 1838
轻奢々
轻奢々 2020-12-05 07:33

How to get the absolute path for a given relative path programmatically in Linux?

Incase of Windows we have the _fullpath() API. In other words, I mean

7条回答
  •  广开言路
    2020-12-05 08:05

    The is also another useful way, like "readlink -m $filename"

    First of all, it works without requirement for target file to exist. Secondly, it will handle symlinks and get really real path.

提交回复
热议问题