Reference to a bash variable whose name contains dot

Bash itself doesn’t understand variable names with dots in them, but that doesn’t mean you can’t have such a variable in your environment. Here’s an example of how to set it and get it all in one:

env 'agent1.ip=192.168.100.137' bash -c 'env | grep ^agent1\\.ip= | cut -d= -f2-'

Leave a Comment