ph10@??? said:
} However, to do something like "take the first letter of the local
} part" without a file lookup needs a new operator in the expansion
} mechanism. That would be easy to do, I think. I have noted the idea.
}
Actually I had assumed there was a regular expression handler in the
expansion stuff and was suprised to not find it, and a general way of
handling this would be a regexp expression - say
${regexp{<regexp>}{<string>}[{<ret-if-found>}[{<ret-if-fail>}]]}
where
<regexp> - regulsar expression
<string> - the thing you are applying the expression to
<ret-if-found> - expansion variable if there is a match
may contain $1..$n for sub part matches
<ret-if-fail> - what is returned if the expression fails.
So the first character thing could be done as
file = "/vars/spool/mail/\
${regexp{"^(.)"}{$local_part}{$1}{fail}}/\
$local_part"
Nigel.
--
[ Nigel.Metheringham@??? - Unix Applications Engineer ]
[ *Views expressed here are personal and not supported by PLAnet* ]
[ PLAnet Online : The White House Tel : +44 113 251 6012 ]
[ Melbourne Street, Leeds LS2 7PS UK. Fax : +44 113 2345656 ]