小编cur*_*one的帖子

避免列出以 ~ 结尾的文件(备份文件)

我的要求是列出目录中的所有文件,但以~(备份文件)结尾的文件除外。

我尝试使用命令:

ls -l | grep -v ~    
Run Code Online (Sandbox Code Playgroud)

我得到这个输出:

asdasad
asdasad~
file_names.txt
normaltest.txt
target_filename
testshell1.sh
testshell1.sh~
testshell2.sh
testshell2.sh~
testtwo.txt
testtwo.txt~
test.txt
test.txt~
Run Code Online (Sandbox Code Playgroud)

我只想获取这些文件:

asdasad
file_names.txt
normaltest.txt
target_filename
testshell1.sh
testshell2.sh
testtwo.txt
test.txt
Run Code Online (Sandbox Code Playgroud)

ls filenames

20
推荐指数
5
解决办法
3860
查看次数

标签 统计

filenames ×1

ls ×1