remote-notmuch.sh

Tomi Ollila tomi.ollila at iki.fi
Wed Oct 26 03:04:55 PDT 2011


Hi

The remote-notmuch.sh script on page http://notmuchmail.org/remoteusage/
starts to show it's age. As the notmuch command line interface has evolved
(and emacs ui followed) it is not working in many cases anymore.

I took the script and modified it to work in my cases so far.

If you have problems with remote-notmuch.sh take a look this modified
version. For the time being it is located at 
http://www.iki.fi/too/nottoomuch/remote-notmuch.sh

If this proves to be working better in other users use then I can
update the script on the remoteusage page also.

Changes:

Changed shebang to '#!/bin/sh' -- tested the script works with /bin/bash &
/bin/dash -- It should also work with http://heirloom.sourceforge.net/sh.html
but I did not test.

Changed sha1sum to 'openssl sha1' -- should work identically everywhere
where openssl is installed (Linux, *BSD, Mac OS X, ...).

Changed arg quote mangling for ssh command line: Every arg is encapsulated
between ':s and ':s in args replaced with '\'' construct. Note that shell
builtin echo expansions cannot be handled here but in this case this
doesn't cause problems; example: foo=-n bar='\n'; echo "$foo" x "$bar" y 
(but see at the end of this email..)

'notmuch show' checks that first arg is --format=raw and last begins with id:
-- and in this case uses the whole command line as hash key.

'case' used to choose internal command and shifts there removed.


Tomi

PS: I tested replacement for "'`echo "$arg" | sed "s/'/'\\\\\\''/"`'":

for a
do	x=`awk -v arg="$a" "BEGIN { while (index(\"'\", arg)) 
		sub(\"'\", \"'\\\\\\''\", arg); printf \"'%s'\", arg }"`
	echo "$x"
done

on command line. I include this into my script and test first before putting
to the 'released' version.


More information about the notmuch mailing list