使用bash,如何编写if语句来检查存储在名为“$DIR”的脚本变量中的某个目录是否包含不是“.”的子目录.要么 ”..”?
谢谢,– 戴夫
这是一种方式:
@H_404_7@#!/usr/bin/bash
subdircount=`find /d/temp/ -maxdepth 1 -type d | wc -l`
if [ $subdircount -eq 2 ]
then
echo "none of interest"
else
echo "something is in there"
fi