Hi!
Actually this is not a question but rather an answer to my own questions/problems, which I think is worth posting here (thanx to acid_kewpie and Dark_Helmet for suggestions on this topic posted previously).
So here it goes:
this is a (bash) function for checking your path entries for duplicates and that evil dot (.)
Code:
function setpath() {
newpath=""
for old in $(echo $1 | sed -e "s/:/\n/g" | grep -v "\.")
do
if [ -d "$old" ]
then
bad=0
for new in $(echo $newpath | sed -e "s/:/\n/g")
do
if [ "$old" == "$new" ]
then
bad=1
fi
done
if [ "$bad" == "0" ]
then
if [ "$newpath" == "" ]
then
newpath=$old
else
newpath=${newpath}:$old
fi
fi
fi
done
}
... it takes only 1 argument which is a path to test.
To test your $MANPATH you should put:
Code:
setpath "$MANPATH"
export MANPATH=$newpath
after the function ... setting the path to check before it is required
Hope this helps anyone - it sure has served me good.
Enjoy,
Luka