I need a shell script that accepts 2 directories names
bar1 and bar2
as arguments , and deletes those files in
bar2 which are are identical to their name
spaces in
bar1.
I tried with this code but it gives error.
if [ $# -eq 1 ]
then
echo " syntax <comnd dir1 dir2 > "
exit
else
#echo $1 $2
for i in `ls $1`
do
for j in `ls $2`
do
if [ $i=$j ]
then
unlink $j
fi
done
done
fi
o/p :-
bash-3.1$ sh 17.sh
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
unlink: cannot unlink `bar1': Is a directory
unlink: cannot unlink `bar2': Is a directory
bash-3.1$
Thnak you
Krish