tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: JMX with Listener
Date Tue, 11 Dec 2012 21:53:30 GMT
Cédric Couralet wrote:
> One question, though, in the tomcat doc (for 6.0.x) for the
> JMXRemoteListener, the configuration is :
> while mine is${CATALINA_BASE}/conf/jmxremote.password
> (notice the {} ).
> is it my mistake?

No, it is not a mistake.  The above are lines extracted from a shell script, I presume.
In this particular case, $CATALINA_BASE and ${CATALINA_BASE} are equivalent.
The {} form helps to clarify things for the shell when the character which *follows* the 
name of the variable, could be considered by the shell as part of the variable name.
For example in :

echo "something" > $my_file_conf

it is not clear whether the name of the variable is "my" or "my_file" or "my_file_conf".
(or anything in-between), and by default the shell will use the longer possibility.

Writing this as

echo "something" > ${my_file}_conf

leaves only one possible interpretation.

In "$CATALINA_BASE/conf/jmxremote.password" there is really no ambiguity (because "/" 
cannot be part of a variable name), but the form 
"${CATALINA_BASE}/conf/jmxremote.password" is anyway clearer and less prone to oversights.
(But it is slightly more work to type, and as programmers are a notoriously lazy and 
hubristic bunch, they rarely go through the trouble).

I suppose that - just to kid Christopher - I could on like this, talking about 
interpolation and stuff, but I'll leave it at that because it's already late here.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message