Pipe Commands#
Some NeoMutt config options can run a shell command and use its output instead of a static value.
You enable this by ending the value with a | (pipe) character.
This tutorial walks through the most common use case: generating your email signature dynamically.
Step 1 β A Static Signature#
The simplest signature setup points $signature at a plain text file:
set signature = "~/.signature"
The file ~/.signature might contain:
Regards,
Alice
Every outgoing email gets the same signature.
Step 2 β Make It Dynamic with a Pipe#
Suppose you want your signature to include todayβs date, a quote of the day, or different content depending on the recipient.
Instead of a static file, you can point $signature at a script β just add | at the end:
set signature = "~/.mutt/gen-sig.sh|"
NeoMutt will:
Strip the trailing
|Execute
~/.mutt/gen-sig.shas a shell commandRead its standard output as the signature text
Step 3 β Write the Script#
Create the script ~/.mutt/gen-sig.sh:
#!/bin/sh
echo "Regards,"
echo "Alice"
echo ""
echo "Sent on $(date '+%A, %d %B %Y')"
Make it executable:
$ chmod +x ~/.mutt/gen-sig.sh
Now every email will have a signature like:
Regards,
Alice
Sent on Monday, 07 April 2025
Step 4 β Test It#
You can verify your script works by running it directly:
$ ~/.mutt/gen-sig.sh
Regards,
Alice
Sent on Monday, 07 April 2025
Then compose a test message in NeoMutt and check that the signature appears correctly at the bottom of the message body.
How It Works#
NeoMutt supports the trailing pipe in two categories of config options:
- Path options (like
$signature) The value is treated as a command. NeoMutt runs it and reads the full output as if it were a file.
- Expando options (like
$index_format,$status_format, and others) After NeoMutt expands the format string, if the result ends with
|, the expanded string is executed as a command and the first line of output replaces it.
See also
Config Types β Pipe Support lists both mechanisms and all supported options