001、
[root@localhost test3]# ls a34 a45 b34 b54 c23 c34 dirab [root@localhost test3]# tree . ├── a34 ├── a45 ├── b34 ├── b54 ├── c23 ├── c34 └── dirab 1 directory, 6 files ## 将该目录中以a和以b开头的文件或者目录复制到dirab中去 [root@localhost test3]# for i in a b; do ls | grep "^$i" | while read j; do cp $j dirab/; done; done
标签:test3,shell,dirab,关键字,done,linux,root,localhost From: https://www.cnblogs.com/liujiaxin2018/p/16814445.html