Steffen Nurpmeso wrote in <20220722224655.eo26r%[email protected]>: |Stephen Isard wrote in | <[email protected]>: ||On Fri, 22 Jul 2022, hbezemer-at-kliksafe.nl |s-nail| wrote: ||> I want to delete all mail which is older then one year. This can be ||> done with the '(before date)' search expression as described in the ||> manpage. To automate this process, I would like to use the shell ||> date(1) command to get the date one year ago. How can I import the ||> outcome of command into mailx? I get the right string with: date ||> --date='last year' +%d-%b-%Y So I'm looking for something like: ?move ||> '(before <outputfromdatecommand>)' +Trash || ||If you call s-nail with || ||s-nail -S yearold=`date --date='last year' +%d-%b-%Y` || ||the variable yearold within s-nail will contain the date string. | |It should be possible to script this in the MUA alone, even if the |syntax is crude (and letting error handling etc. aside): | | $ mailx -#:/ | ? vexpr date-utc | dutc_year=2022 dutc_month=7 dutc_day=22 dutc_hour=22 dutc_min=38 \ | dutc_sec=50 | ? vput vexpr x date-utc | ? echo $x | dutc_year=2022 dutc_month=7 dutc_day=22 dutc_hour=22 dutc_min=39 \ | dutc_sec=12 | ? eval set $x | ? echo $dutc_year | 2022 | ? vput vexpr dutc_year - $dutc_year 1 | ? var dutc_year version v15-compat | set dutc_year=2021 | #set version=v14.9.24 | #variable not set: v15-compat
Note that we do not offer format strings anywhere (yet), and the above does not offer month names; problems, dependent upon what you do: for example IMAP search expressions want the month name. But you can use `vput' also with the shell command: $ mailx -#:/ ? ! date --date='last year' +%d-%b-%Y 23-Jul-2021 ! ? vput ! x date --date='last year' +%d-%b-%Y ? echo $x 23-Jul-2021 Newline is stored in $x, (may) need to trim it away: ? vput csop x trim $x ? echo $x 23-Jul-2021 ? --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)
