如何不列出“。”和“..”在 curl 命令中:“curl -l ftp:”

How to not list "." and ".." in curl command : " curl -l ftp: "

命令:curl -l ftp://test:test@test/test/

任务:不列出“.”和“..

输出:

.
..
test.txt
test_2.txt

期望的输出:

test.txt
test_2.txt

使用 GNU sed。我建议将此附加到您的命令中以删除仅包含一个或两个点的行:

| sed -r '/^\.{1,2}$/d'

并添加到 curl 选项 -s(静默)以抑制其统计输出。


参见:man sedThe Stack Overflow Regular Expressions FAQ