Ethereal-users: Re: [Ethereal-users] shell variable in tethereal display filter

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 27 Sep 2005 11:56:51 -0700
jlee@xxxxxxxxxxxxxxx wrote:

tethereal -r $CAPTURE_FILE -z sip,stat,'ip.src==$IP_SRC'

When I run the script the value for $IP_SRC is not substituted correctly in the filter.

It's not *supposed* to be substituted, as that string is in single quotes; it would be *incorrect* for any Bourne-compatible or csh-compatible shell to do substitution in that command.

Is there a correct syntax for using a variable in the filer string?

Yes. The syntax for using a variable in *any* quoted string in a UN*X shell (even if that shell is running on Windows, e.g. in Cygwin) is to put the string in *double* quotes:

	tethereal -r $CAPTURE_FILE -z sip,stat,"ip.src==$IP_SRC"

See the sh(1), ksh(1), bash(1), csh(1), etc. man pages.