|
楼主 |
发表于 2020-7-22 11:45:01
|
显示全部楼层
#!/bin/sh
function compare
{
if [ `cd $Dname` ]; then
list=`ls *.{.c,.cpp}`
echo "the result of compare:"
for file in $list ; do
for otherfile in $list ; do
if [ $file!=$otherfile ]; then
if [ ![ cmp $file $otherfile ] ]; then
echo "$file and $otherfile have the same content"
fi
fi
done
done
}
echo "input a directory name"
read Dname
if [ $Dname!="" ]; then
compare
else
$Dname="." #use current directory as input
compare
fi
#我这样写有错吗,我现在调了没有调试出来,哪位高手帮我看看!谢谢 |
|