Some more bash fun.
Save your buddies list in some file (~/.PlaneShift/buddies.txt let's say), and the above list script as zeroping_online.sh
Create this script below in the same directory as show_ps_buddies.sh let's say (for examplel in ~/bin, so we have ~/bin/show_ps_buddies.sh and etc.):
#!/bin/bash
zeroping_online="`dirname ${BASH_SOURCE[0]}`/zeroping_online.sh"
if (($# < 1)) || (($# > 2))
then
echo -e "\nInvalid number of arguments specified!\n\
Usage: `basename $0` <buddies_list_file> [all]\n\
Note : If 'all' (or actually anything) is provided as a second parameter, buddies will be highlighted in the full list, instead of being filtered from it."
exit 1
fi
if (($# == 1))
then
show_all=false
else
show_all=true
fi
col_prefix=${buddies_color:-'\e[1;32m'}
col_suffix='\e[0m'
buddies_list_file=$1
if [ ! -f "$buddies_list_file" ]; then echo "Invalid buddies list file ${buddies_list_file} specified!"; exit 2; fi
online_list=( `$zeroping_online` )
buddies_list=( `sort -u $buddies_list_file` )
echo -e "Total users on-line: ${#online_list[*]}\n\
------------------------"
i=0
j=0
while [ $i -lt ${#online_list[*]} ] && [ $j -lt ${#buddies_list[*]} ]
do
if [[ "${online_list[$i]}" < "${buddies_list[$j]}" ]]
then
if $show_all; then echo ${online_list[$i]}; fi
((i++))
elif [[ "${online_list[$i]}" == "${buddies_list[$j]}" ]]
then
echo -e ${col_prefix}${online_list[$i]}${col_suffix}
((i++))
((j++))
else
((j++))
fi
done
while $show_all && [ $i -lt ${#online_list[*]} ]
do
echo ${online_list[$i]}
((i++))
done
Now just run it with path to buddies list and optional second parameter (if present it includes full list).
Override buddies_color to change highlighting color. For example:
buddies_color='\e[1;33m' ~/bin/show_ps_buddies.sh ~/.PlaneShift/buddies.txt all