procmail
[Top] [All Lists]

Re: calling shell functions

1997-08-26 13:31:39
Terry Jones suggested,

|   2) SHELL = /bin/bash          # or some shell with functions
|      LENGTH = `length "$FROM"`
|
|      Where length is a shell function you write (and export) that
|      returns the length of its argument.

Uh, not quite.  You'll need

       LENGTH = `length "$FROM";`

Because without a character from $SHELLMETAS procmail will try to run the
command itself without invoking a shell, and there will be no executable
file in $PATH named "length".  You have to force a shell.

The same goes for using shell built-ins like eval.

And as long as you're forcing a shell, perhaps it has the feature built
in and you don't need to write your own function:

  SHELL=/bin/ksh
  LENGTH=`echo ${#FROM};`

<Prev in Thread] Current Thread [Next in Thread>