Re: Unable to configure index_format in Mutt
On Sun, Nov 18, 2001 at 05:03:06PM -0800, Marc Wilson wrote:
> On Mon, Nov 19, 2001 at 12:45:21AM +0100, Carel Fellinger wrote:
> > Welcome in shell quoting hell.
> > You need extra single quotes around the full command like:
> > folder-hook in-l-debian-user 'set index_format="format of your liking"'
> > ^ ^
> What does this have to do with a shell? This goes in ~/.muttrc.
I knew it when I typed it in:)
mutt like procmail allows a lot of things to be done in its rc file,
and (un)luckily those things resemble shell scripting, most notably
some of its quoting problems are preserved:(
the folder-hook command expects a name and a command. If that command
is to contain spaces then the whole command has to be quoted, hence the
single quotes. In case a parameter to that quoted command itself needs
spaces, that parameter has to be quoted, hence the double quotes. If
part of a command string has to be evaluated in a shell at rc scan time
then it has to be enclosed in back ticks. And like in the shell you can
combine backticks and quoting, and like the shell this leads to hard to
understand quoting behaviour.
So applying this to the mutt-rc-command at hand, we get:
1) there is a space between set and index_format, so we need to quote
all of it.
2) Moreover the value spacified for index_format contains spaces, so
it to has to be quoted.
3) Using the same type of quotes for both is not going to work, so
resort to using single quotes for one pair of quotes and double
quotes for the other.