bash noob here. I have a bash command that if I execute as normal from the command line returns an ip address:
kubectl get svc ssdl-web --namespace default -o jsonpath='{$.status.loadBalancer.ingress[0].ip}'
returns:
104.76.131.131
However if I store the command in a var and then execute it the answer comes back wrapped in apostrophes:
get_external_ip_cmd="kubectl get svc ssdl-web --namespace default -o jsonpath='{$.status.loadBalancer.ingress[0].ip}'" && echo $($(echo $get_external_ip_cmd))
'104.76.131.131'
I need the result without the apostrophes.
I'm sure there's a simple explanation but I haven't a clue what. Can anyone fill me in? thx.
(My reason for storing the command in a var is that I want to execute it multiple times)