On 7 Sep 2001, at 2:21, Piet Delport wrote:
> - The ${foo} syntax expands to the contents of variable "foo",
> not to
> the output of command "foo". For command substitution, either
> use $(foo), or `foo` (note the backticks). The $(foo) form
> nests easier than the `foo` form, but the latter is more common
> between shells.
Thanks, I will use $().
> To get around this, you can do something like the following
> (sorry for the long line):
>
> find $MAILDIR/ \
> \! \( -name 'sent-*' -o -name trash -o -name draft \) \
> -exec mutt -f {} \
> -e 'push "<tag-message>~d -'`date --date=$ARCHDATE
> '+%d/%m/%Y'`"<tag-prefix><save-message>{}<quit>\"" \;
>
> Don't panic. :-) Basically, this does the find, and just directly
> executes mutt on each of the matching folders.
>
> I've attached my version of your script with all of the above
> worked in. Warning: it's still totally untested. Comments
> welcome.
Actually, you haven't. However, I have reconstructed the most of
your advice and the result is attached. The find command you
proposed wouldn't work, because the purpose of the command is to
move messages from the folder in $MAILDIR to the one in
$ARCHDIR, which cannot be accomplished via mere {}. See my
proposed solution, which is not optimal either, because it
doesn't work with mailboxes in the subdirectories of $MAILDIR.
Any thoughts?
And I still do not know how to achieve the last command
(archiving of the sent-* mailboxes).
> [ One minor problem so far is that the FreeBSD date(1) doesn't
> understand the --date option, but has a -v option rather, with:
> -v -3m
> meaning 3 months ago, and
> -v +7d
> meaning 7 days from now, etc. Does GNU date(1) support the -v
> option? ]
No, it calls it -d (or --date as a longer option). There does
not seem to be -v option for GNU date.
Thanks for the advice, anyhow.
Have a nice day
Matej Cepl
archmail.gz