user2596652
user2596652

Reputation:

How to use variable inside mailboxes parameter?

I'm trying to configure mutt on Fedora 30 with user-defined variable (my_<name>). To avoid repeating the same path name all over the place, I'd like to use a variable to specify the mailboxes location. I create the list of mailboxes using a shell command.

I use the mailboxes parameter to create list of mail boxes dynamically. I'm trying to re-use the $folder variable to tell the shell command the directory to go to find the mailboxes.

### where are my email accounts ?
set my_mail_root_dir = $HOME/Mail

set mbox_type = Maildir

### folders for my Hotmail account
set folder = $my_mail_root_dir/hotmail
set mbox = $folder/Inbox
set spoolfile = $folder/Inbox

### create list of mailboxes trying to use '$folder'
mailboxes `echo -n "+ "; cd $folder; find . -maxdepth 1 -type d -name "*" -printf "+'%f' "`

### it will work using hardcoded directory:
#mailboxes `echo -n "+ "; cd ~/Mail/hotmail; find . -maxdepth 1 -type d -name "*" -printf "+'%f' "`

I'm looking for a way to use an existing variable inside the mailboxes shell command.

Is it something possible ?

Upvotes: 3

Views: 252

Answers (1)

Jakub Jindra
Jakub Jindra

Reputation: 591

Try adding this line to your configuration above the mailboxes command.

setenv folder "$folder"

This should add environment variable folder containing $folder value, so the bash as the neomutt child process will have this variable visible.

Upvotes: 1

Related Questions