On Mon, Nov 2, 2015 at 9:42 AM, Arkadiusz Drabczyk <arkadi...@drabczyk.org> wrote: > On 2015-11-01, Xu Wang <xuwang...@gmail.com> wrote: >> Hello, >> >> I am frequently using ~iMSGID to search for a message ID matching >> MSGID. However, if MSG contains '$1' then that does not work. Funnily, >> if it contains $abc then it is not a problem. I have tried escapes for >> '$' but it is not working. > > Hi, > > This is working for me on Linux: > > ~i '\$1' > > The key is to put an entire expression in single quotes as by default > $ is used to expand variables. The following fragments of man muttrc > mention this: > > "Single quotes ("'") and double quotes (""") can be used to quote > strings which contain spaces or other special characters. The > difference between the two types of quotes is similar to that of many > popular shell programs, namely that a single quote is used to specify > a literal string (one that is not interpreted for shell variables or > quoting with a backslash [see next paragraph]), while double quotes > indicate a string which should be evaluated. For example, backticks > are evaluated inside of double quotes, but not single quotes. > (..) > UNIX environment variables can be accessed like the way it is done in > shells like sh and bash: Prepend the name of the variable by a dollar > ("$") sign." > > BTW, > > ~i $abc > > doesn't work for me, I get `Empty expression', > ~i \$abc > and > ~i '$abc' > return no results, > ~i '\$abc' > works correctly. > > If I start mutt like this: > > $ abc=abc mutt > > then the following works for me because abc variable is expanded > > ~i $abc > > -- > Arkadiusz Drabczyk <arkadi...@drabczyk.org>
Thank you so much Arkadiusz! I am on Linux as well and it works perfectly. Your explanatory comments are also very great! I have learned a lot and even though I have read man muttrc now I can read again with better understanding and now good example. Many thank yous for your time and for your help, Arkadiusz. Kind regards, Xu