我的要求是列出目录中的所有文件,但以~(备份文件)结尾的文件除外。
我尝试使用命令:
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)