Simon icon Simon
Flexible server monitoring

Simon shell Script filter: how to get the complete, unmodified input text

Hi,
is it possible in a Simon shell script filter (any of zsh/sh/ksh/bash/tcsh/csh would be ok, probably even python would be ok) to pipe the complete, unmodified input text to some kind of utility, in a way similar to:

echo "{FilterInputText}" | myutility

This looks the right way, except when FilterInputText contains such characters as quotes, dollar, ampersand, (e.g. HTML code).

echo '{FilterInputText}'  | myutility

will also fail if single or double quotes are present in input text, not speaking of $, & and < >.

cat <<THISISMYENDOFFILEMARKER | /usr/local/bin/myutility
{FilterInputText}
THISISMYENDOFFILEMARKER

also breaks with some special chars in input text (such as backquote etc).

The script's stdin is not set to the input text, either.

This is a recurrent issue in all shells, and it has NO shell-level solution.

Does Simon include some way to solve this? Such as escaped string/environment variable/temp file/<insert some idea here>? If not, I hope it will in a (near-)future release...

Thanks in advance,
Pascal;

David Sinclair's picture

Re: Simon shell Script filter: how to get the complete, ...

Hi Pascal,

There isn't an escaped variation of the variable, but you could achieve this via another filter (or filters) prior to this one, using a Find-based filter to use a regular expression to replace quotes with escaped quotes, etc.

Hope this helps.