I have a shell command spurious ports
which returns the following data...
Service Host Port Browser link
spurious-elasticache-docker 192.168.59.103 32794 -
spurious-sqs sqs.spurious.localhost 32789 http://sqs.spurious.localhost:32789
spurious-s3 s3.spurious.localhost 32790 http://s3.spurious.localhost:32790
spurious-elasticache 192.168.59.103 32793 -
spurious-dynamo dynamodb.spurious.localhost 32791 http://dynamodb.spurious.localhost:32791
spurious-browser browser.spurious.localhost 32795 http://browser.spurious.localhost:32795
spurious-memcached 192.168.59.103 32792 -
If I want to get the port number for the "dynamo" service then the following shell script works...
lines=`spurious ports`; echo $lines | grep "dynamo" | awk '{print $3}'
This retuns 32791
But if I try and run this from inside a Makefile, I instead get the entire spurious ports
output (all on one line?):
foobar:
$(eval port:=$(shell lines=`spurious ports`; echo $$lines | grep 'dynamo' | awk '{print $3}'))
@echo $(port)
I've also tried moving the commands into a shell script file:
#!/bin/sh
lines=`spurious ports`; echo $lines | grep "dynamo" | awk '{print $3}'
And inside the Makefile used:
PORT:=$(shell ./scripts/spurious-ports.sh)
bing:
@echo $(PORT)
But this doesn't work either.