3 # we guess at some nice values to use in the list. if these are too small, we'll
4 # adjust them before printing anything.
9 # column headings, and a placeholder to be fixed later.
12 locats=('Grid Coords' hold)
14 # run through and get the data first...
15 for region_ini in $HOME/opensim/bin/Regions/*.ini; do
16 name="$(grep "\[.*\]" <"$region_ini" | head -n 1 | tr -d \[\] | sed -e 's/[\r\n]//g' )"
17 if [ ${#name} -gt $max_name ]; then max_name=${#name}; fi
18 names[${#names[*]}]=$name
19 port="$(grep "InternalPort" <"$region_ini" | head -n 1 | sed -e 's/InternalPort *= *//' -e 's/[\r\n]//g' )"
20 if [ ${#port} -gt $max_port ]; then max_port=${#port}; fi
21 numbers[${#numbers[*]}]=$port
22 location="$(grep "Location" <"$region_ini" | head -n 1 | sed -e 's/Location *= *//' -e 's/[\r\n]//g' )"
23 if [ ${#location} -gt $max_location ]; then max_location=${#location}; fi
24 locats[${#locats[*]}]=$location
28 while [ ${#dash} -lt $max_name ]; do dash+='='; done
31 while [ ${#dash} -lt $max_port ]; do dash+='='; done
34 while [ ${#dash} -lt $max_location ]; do dash+='='; done
37 #echo names list is ${names[*]}
38 #echo ports list is ${numbers[*]}
39 #echo locations list is ${locats[*]}
41 # now print the data in a pleasant fashion...
43 for region_ini in header line $HOME/opensim/bin/Regions/*.ini; do
44 # indy is a zero-based array index.
46 port=${numbers[$indy]}
47 location=${locats[$indy]}
48 while [ ${#name} -lt $max_name ]; do name+=' '; done
49 while [ ${#port} -lt $max_port ]; do port+=' '; done
50 while [ ${#location} -lt $max_location ]; do location+=' '; done
51 if [ "$region_ini" == "header" ]; then
52 region_ini='Region Config File'
53 elif [ "$region_ini" == "line" ]; then
54 region_ini='===================='
56 echo "$name $port $location $(basename "$region_ini")";