How can I run a mutt macro at startup (from command line)?

2

1

As an example: mutt -e '<limit>all\\n', causes:

Error in command line: <limit>all\n: unknown command
Press any key to continue...

How can I have mutt interpret that correctly?

(I've also tried variants like mutt -e 'macro index "<limit>all\\n"'.)

user569825

Posted 2016-04-21T22:34:37.463

Reputation: 179

Answers

3

You need two changes to your command to get it to work:

  1. use mutt's push command to execute functions
  2. use <enter> rather than \\n to trigger the enter key at the end of the command

Thus, this is the command needed:

mutt -e "push '<limit>all<enter>'"

Useful reference: Mutt's function listing for macros.

puzzlement

Posted 2016-04-21T22:34:37.463

Reputation: 261

May this be combined with variables defined in muttrc? I am trying to do mutt -e "push '$my_limit_cmd'" in order to start out with a custom filter. – user569825 – 2016-06-21T11:18:40.763

Can you give an example of what you're setting $my_limit_cmd to? – puzzlement – 2016-06-24T03:45:09.000

set my_limit_cmd="<limit>all<enter>" for example, – user569825 – 2016-06-25T10:07:21.477