linux中生成文件的绝对路径

1、测试文件

[root@centos79 test]# touch a.txt b.txt
[root@centos79 test]# ls
a.txt  b.txt

2、生成测试文件的绝对路径

[root@centos79 test]# ls
a.txt  b.txt
[root@centos79 test]# ls *.txt | xargs -I {} echo "$PWD/{}"
/home/test/a.txt
/home/test/b.txt
原文地址:https://www.cnblogs.com/liujiaxin2018/p/15111337.html