对于作为用户输入提供的多个文件夹,我想要统计它们包含的文件和文件夹的数量与容器文件夹本身具有不同的权限设置。Shell程序不起作用
我写了下面的shell代码。它为什么显示权限,但不计算任何内容?
#!/bin/sh
if [ ! -d $1 ]
then echo $1 nu este director
exit1
fi
ls -R $1 >temp
permission= ls -al $1 | cut -d" " -f1
for i in `cat temp`
do
perm= ls -l $i | cut -d" " -f1
if [ $permission -ne $perm ]
then n=`expr $n + 1`
fi
echo $n
done