This works with multiple separators and does not assume the given path should exist:
p=/foo///.//bar///foo1/bar1//foo2/./bar2;
echo $p | awk '{while(index($1,"/./")) gsub("/./","/"); while(index($1,"//"))
gsub("//","/"); print $1;}'
But does not simplify well strings containing ".."