In bash I got all the names from services which are balanced from /etc/haproxy. But now I want to store all these intro a $srv variable in order to continue my healthcheck script.
for filename in /etc/haproxy/*.cfg; do
for ((i=0; i<=0; i++)); do
srv = $(echo $filename | awk -F'[/.]' '{print $4}')
echo $srv
done
done
Using echo $filename | awk -F'[/.]' '{print $4}' is showing the correct microservices names like: service1 service2 service3
=in shell assignments.srv="$(echo "$filename" | awk -F'[/.]' '{print $4}')"