[neomutt-users] executing shell scripts with startup-hooks

Richard Russon rich at flatcap.org
Sun Nov 10 11:58:47 CET 2019


Hi Steve,

> has anyone got executing shellscripts with startup-hook or shutdown-hook

A simple way to do it is to use backticks (``).
(tested with 2018-07-16 and 2019-11-02)

    startup-hook  'echo "`date | tee -a startup.log`"'
    shutdown-hook 'echo "`date | tee -a shutdown.log`"'

The hooks are expecting a *NeoMutt* command, so we'll use 'echo'.
Anything put in backticks (``) will be executed and its output will be
passed to the 'echo' command.  We quote ("") the backticks just in case
there's whitespace in the output.

The command writes the date to a file, but also displays it to the user.
The message isn't visible because of lots of redrawing during startup,
but you can see it in the logs ('M' <show-log-messages>).

Cheers,
    Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20191110/bdeae6eb/attachment.sig>


More information about the neomutt-users mailing list