procmail
[Top] [All Lists]

Re: tilde expansion

1998-02-03 08:23:18
Guy Geens recommended to Filippo Basso,

| PROVA=`cat $HOME/prova`

... and cautioned,

| Note that procmail doesn't do ~ expansions, so you have to use $HOME

Right.  Guy pondered further,

| (Although I think this example might work with a ~, depending on the
| setting of $SHELL - just be on the safe side, and don't use ~ in your
| .procmailrc)

It would, because the tilde is in $SHELLMETAS, so when procmail sees a
tilde, it will invoke a shell.  Of course, if your $SHELL setting is
something that doesn't grok tildes either, you're stuck.

It's better to skip the extra process of a shell and use the $HOME variable,
as Guy originally suggested.  However, procmail knows only the user's home
directory and no one else's, so if you need to refer to another user's home
directory -- say, if another user at Filippo's site wants to use his prova
file -- the technique can be useful:

  SHELL=/something/that/groks/tildes
  PROVA=`cat ~basso/prova`

Then again, it's better yet to put a symlink somewhere under your own home
directory that points to the other user's file so that you can use the $HOME
variable in your .procmailrc and avoid the shell invocation.

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