python os.path.abspath realpath 區別
#home
cd /home
mkdir a
mkdir b
touch a/1.txt
ln -s /home/a/1.txt /home/b/1.txt
python
進入實時模式
>>> import os
>>> os.path.abspath("a/1.txt")
'/root/a/1.txt'
>>> os.path.abspath("b/1.txt")
'/root/b/1.txt'
>>> os.path.realpath("b/1.txt")
'/root/a/1.txt'
>>> os.path.realpath("a/1.txt")
'/root/a/1.txt'
>>>
realpath 返回的是 使用軟鏈 的真實地址
abspath 返回目標地址