I am trying to replace a specific string (hostname), inside a main string, with a variable value using the following command,
set newVar [string map {`hostname` $theHost} 'lsnrctl status listener_`hostname`']
However, instead of replacing hostname with the variable value, it replaces it using the variable identifier, i.e. "$theHost".
The newVar reads like this,
lsnrctl status listener_$theHost
I want it to be this,
lsnrctl status listener_theHostName
where "theHostName" is the value of the variable "$theHost".
How can I achieve this?