Skip to content

Commit 81a5d78

Browse files
committed
fixed dublicates in ip listing for user vesta
1 parent 74005a9 commit 81a5d78

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bin/v_list_user_ips

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ json_list_user_ips() {
2323
echo '{'
2424

2525
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
26-
shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
26+
shared_ips=$(grep -H -A5 "OWNER='vesta'" $V_IPS/* |\
2727
grep "STATUS='shared'"|\
2828
cut -f 1 -d - )
2929

30-
ip_list="$owned_ips $shared_ips"
30+
ip_list="$owned_ips\n$shared_ips"
3131
fileds_count=$(echo "$fields" | wc -w)
3232

3333
# Starting main loop
34-
for IP in $ip_list; do
34+
for IP in $(echo -e "$ip_list" | sort -u); do
3535
IP=$(basename $IP)
3636
ip_data=$(cat $V_IPS/$IP)
3737

@@ -75,11 +75,11 @@ json_list_user_ips() {
7575
# Shell function
7676
shell_list_user_ips() {
7777
owned_ips=$(grep -l "OWNER='$user'" $V_IPS/*)
78-
shared_ips=$(grep -A5 "OWNER='vesta'" $V_IPS/* |\
78+
shared_ips=$(grep -H -A5 "OWNER='vesta'" $V_IPS/* |\
7979
grep "STATUS='shared'"|\
8080
cut -f 1 -d - )
8181

82-
ip_list="$owned_ips $shared_ips"
82+
ip_list="$owned_ips\n$shared_ips"
8383
if [ -z "$nohead" ]; then
8484
# Print brief info
8585
echo "${fields//$/}"
@@ -90,7 +90,7 @@ shell_list_user_ips() {
9090
fi
9191

9292
# Starting main loop
93-
for IP in $ip_list; do
93+
for IP in $(echo -e "$ip_list" | sort -u); do
9494
IP=$(basename $IP)
9595
ip_data=$(cat $V_IPS/$IP)
9696

0 commit comments

Comments
 (0)