accountsdb='cat test.db | sort'
namex="0"
nameplus=0
ftpfullname="turner"
for output in $accountsdb
do
if [ "$ftpfullname" == "$output" ]
then
let "nameplus += 1"
for i in $nameplus
do
echo "$nameplus"
echo "$i"
if [ "$namex" == "1" ]
then
ftpfullname=${ftpfullname%?}
fi
namex="1"
ftpfullname="${ftpfullname}${i}"
break
done
fi
done
echo "$ftpfullname"
echo $namex
echo "$ftpfullname" >> test.db