如何检索给定相对的绝对路径 [英] How to retrieve absolute path given relative
本文介绍了如何检索给定相对的绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在给定相对路径的情况下,是否有检索绝对路径的命令?
Is there a command to retrieve the absolute path given the relative path?
例如我希望 $line 包含目录 ./etc/
For example I want $line to contain the absolute path of each file in dir ./etc/
find ./ -type f | while read line; do
echo $line
done
推荐答案
use:
find "$(pwd)"/ -type f
获取所有文件或
echo "$(pwd)/$line"
显示完整路径(如果相对路径很重要)
to display full path (if relative path matters to)
这篇关于如何检索给定相对的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文