#!/bin/bash

if [ $# = 1 ]; then
ptools_list=`cat $1`
else
ptools_list=`cat ~/.ptools.conf`
fi

for i in $ptools_list
do
	echo $i > /tmp/ptools.tmp
	rm -f $i
done

if [ $# = 0 ]; then
	rm -f ~/.ptools.conf
else
	cp ~/.ptools.conf /tmp/ptools.1
	sourcefile="/tmp/ptools.1"
	filedest="/tmp/ptools.2"
	for f in `cat $1`
	do
		grep -v $f $sourcefile > $filedest
		temp=sourcefile
		sourcefile=$filedest
		filedest=$temp
	done
	cp -f $sourcefile ~/.ptools.conf
	rm -f $sourcefile
	rm -f $filedest
fi
