在linux中如何用find查找或条件
MacBook-Air:test yansy$ ls
MacBook-Air:test yansy$ 1.jpg 1.txt test.jpg test.txt
MacBook-Air:test yansy$ find . ! -name "test" -name "*txt" -o -name "*.jpg"
./1.jpg
./1.txt
./test.jpg
./test.txt
MacBook-Air:test yansy$ find . ! -name "test*" -name "*txt" -o ! -name "test*" -name "*.jpg"./1.jpg./1.txt
./1.jpg
./1.txt
也可以执行以下命令查找
[yansiyu@iZbp1fna7ky0qz2jbj7gfpZ test]$ find . -type f -regex ".*\(\.txt\|.jpg\)"
./1.txt
./1.jpg