Hi i`m not a very good user of ubuntu terminal. I have to compare two path of two folders and see if the two folders are existing,different and not sub-folder...I wrote this but it doesn`t work good:

#!/bin/bash

echo "insert path1 \c"
read path1
echo "insert path2 \c"
read path2


if [[ ! -d $path1 ]]; then
echo "\"$path1\" is not a folder"
exit
fi

if [[ ! -d $path2 ]]; then
echo "\"$path2\" is not a folder"
exit
fi


if [[ $path1==$path2 ]]; then
echo "\"$path1\" it`s the same of \"$path2\""
exit
fi

check1=$(dirname $path1)
check2=$(dirname $path2)

if [[( $check1 =~ ^$check2 ) && ( $check2 =~ ^$check1 ) ]]; then
echo "sub-folder"
fi




p.s. sorry for my english..