例如,我可以在目录之外使用ls - t | xargs > output.txt吗?
我想访问/home/123/script/final目录,然后执行上面的功能。就像这样:
ls - t | xargs /home/123/script/final > output.txt但被拒绝许可的错误
发布于 2019-01-16 12:10:18
你知道你实际执行的命令是什么吗?
您希望列出该特定目录的文件,因此需要将其作为参数提供给ls,而不是xargs。
ls -t /home/123/script/final | xargs > output.txt发布于 2019-01-16 12:19:34
不需要xargs --立即将ls输出重定向到目标。如果希望在一行中使用所有文件名,请尝试--format=across选项-如果可用的话。
发布于 2019-01-16 12:23:34
我想访问/home/123/script/final目录,然后执行上面的功能。类似于这样的:
ls - t | xargs /home/123/script/final > output.txt但是获得许可被拒绝的错误
有几个问题:
ls -lt而不是ls - t。https://unix.stackexchange.com/questions/494802
复制相似问题