From 5fd906b87d083846982bd327f9bde4d5b61a53dd Mon Sep 17 00:00:00 2001 From: "Fred T. Hamster" Date: Thu, 9 Nov 2017 00:35:59 -0500 Subject: [PATCH] fixed sim lister stopped being fooled by multiple matches on things from the example region file. then realized i don't need to even scan that, since i should only take in ini files and that's an example file. --- scripts/opensim/list_sims.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/opensim/list_sims.sh b/scripts/opensim/list_sims.sh index f2b768fc..d78ab3fc 100644 --- a/scripts/opensim/list_sims.sh +++ b/scripts/opensim/list_sims.sh @@ -12,14 +12,14 @@ numbers=(Port hold) locats=('Grid Coords' hold) # run through and get the data first... -for region_ini in $HOME/opensim/bin/Regions/*; do - name="$(grep "\[.*\]" <"$region_ini" | tr -d \[\] | sed -e 's/[\r\n]//g' )" +for region_ini in $HOME/opensim/bin/Regions/*.ini; do + name="$(grep "\[.*\]" <"$region_ini" | head -n 1 | tr -d \[\] | sed -e 's/[\r\n]//g' )" if [ ${#name} -gt $max_name ]; then max_name=${#name}; fi names[${#names[*]}]=$name - port="$(grep "InternalPort" <"$region_ini" | sed -e 's/InternalPort *= *//' -e 's/[\r\n]//g' )" + port="$(grep "InternalPort" <"$region_ini" | head -n 1 | sed -e 's/InternalPort *= *//' -e 's/[\r\n]//g' )" if [ ${#port} -gt $max_port ]; then max_port=${#port}; fi numbers[${#numbers[*]}]=$port - location="$(grep "Location" <"$region_ini" | sed -e 's/Location *= *//' -e 's/[\r\n]//g' )" + location="$(grep "Location" <"$region_ini" | head -n 1 | sed -e 's/Location *= *//' -e 's/[\r\n]//g' )" if [ ${#location} -gt $max_location ]; then max_location=${#location}; fi locats[${#locats[*]}]=$location done @@ -40,7 +40,7 @@ locats[1]=$dash # now print the data in a pleasant fashion... indy=0 -for region_ini in header line $HOME/opensim/bin/Regions/*; do +for region_ini in header line $HOME/opensim/bin/Regions/*.ini; do # indy is a zero-based array index. name=${names[$indy]} port=${numbers[$indy]} -- 2.34.1