[neomutt-users] conditional source command?

Jakub Jindra jakub.jindra at jakubjindra.eu
Fri Jun 23 16:00:12 CEST 2023

Hi Ullrich,

how about utilize only ls? It seems source command accepts multiple 

source `ls /usr/local/etc/Muttrc /dev/null 2>/dev/null`

The stderr redirection to /dev/null is there to supress ls error output.

If the file config file
- exists: it's source it and /dev/null also
- doesn't exist: ls will still return /dev/null, so neomutt source 
   command won't fail.


On 2023-06-23 15:47, Ulli Horlacher wrote:
>I want to source an extra config file, but only if it exists.
>In my (very old) muttrc I have this ugly command:
>source `test -f /usr/local/etc/Muttrc && echo /usr/local/etc/Muttrc || echo /dev/null`
>Is there a more elegant alternative in neomutt for this code?
>Ullrich Horlacher              Server und Virtualisierung
>Rechenzentrum TIK
>Universitaet Stuttgart         E-Mail: horlacher at tik.uni-stuttgart.de
>Allmandring 30a                Tel:    ++49-711-68565868
>70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
>REF:<20230623134754.GA291555 at tik.uni-stuttgart.de>
-------------- 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/20230623/6b9774cd/attachment.sig>

More information about the neomutt-users mailing list