001、
[root@PC1 test]# ls
[root@PC1 test]# mkdir test1 test2 ## 测试文件夹
[root@PC1 test]# echo "xxx" > test2/a.txt
[root@PC1 test]# ls
test1 test2
[root@PC1 test]# tree
.
├── test1
└── test2
└── a.txt
2 directories, 1 file
[root@PC1 test]# [ $(ls test1 | wc -l) -eq 0 ] ## 如果文件夹为空,返回真
[root@PC1 test]# echo $?
0
[root@PC1 test]# [ $(ls test2 | wc -l) -eq 0 ] ## 如果文件夹不为空,返回假
[root@PC1 test]# echo $?
1