Im writting a script which takes two directories and displays them, then displays the contents which do not match in the two directories.
I tried using the -v command in grep but it does not work properly, ill show you my current code (sorry im new to unix scripting) :
if [ ! $# = 2 ]
then
echo Usage: dircomp dir-name1 dir-name2 ... 1>&2
exit 1
elif [ ! -d $1 ]
then
echo The first argument $1 is not a directory 1>&2
exit 1
elif [ ! -d $2 ]
then
echo the Second argument $2 is not a directory 1>&2
exit 1
else
ls $1 -al > list
ls $2 -al > list2
grep -v -f list list2
rm list
rm list2
exit 0
fi
-----
Thanks in Advance