Re: portable shell scripts

2016-04-08 Thread Christian Brabandt
On Do, 07 Apr 2016, David Champion wrote:

> > but printf for parameterised output:
> > 
> >  printf '%s\n' "$arbitrary_value"
> 
> I've started leaning on printf for newline-less printing lately -- it's
> just easier.  But you must be careful to use 'printf %s "$foo"' instead
> of just 'printf $foo', since otherwise a % in input can thwart.
> 
> > and I have my own script "necho" for "echo with no newline" for the
> > appropriat platform (or I make a shell function necho() calling printf for
> > the same purpose, depending on context). Then one can go:
> 
> Let's see if I can get this right from memory:
>   case "`echo -n`" in)
>   -n) necho () { echo "$@""\c"; };;
>   *)  necho () { echo -n "$@"; };;
>   esac

I mentioned Sven Maschecks Website before and he has some information 
about echo/printf as well
http://www.in-ulm.de/~mascheck/various/echo+printf/

> 
> Speaking of which, it's taken me until the last year to use $(command)
> consistently instead of `command`, and I'm not sure anymore why I was
> a stickler.  I assume some older shell didn't support $() but I can't
> recall which.

http://www.in-ulm.de/~mascheck/various/cmd-subst/

And the other pages are worth a look as well, if one is interested in 
those things.

regards,
Christian


Re: How do you survive without notmuch?

2016-04-08 Thread Sebastian Tramp
On Thu, Apr 07, 2016 at 07:53:48PM +0200, Andreas wrote:

> > Usually when I reach for notmuch it is because I have mismanaged my
> > folders.  Hmm, that message about blah isn't there - where is it?
> 
> Me too and while it does find the message it does not tell me /where/ it
> is. How do you do this?

muttjump [1] claims to be able to solve this problem but I did not tested it.
I'm usually totally fine with the feature of getting the whole thread of
a message (-r thread parameter for notmuch-mutti [2])

macro index,pager ,t \
"set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key 
nopipe_decode nowait_key\
notmuch-mutt -r thread\
`echo 
${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`\
set pipe_decode=\$my_old_pipe_decode 
wait_key=\$my_old_wait_key" \
  "notmuch: reconstruct thread"

Best regards

Sebastian Tramp


  1. https://github.com/weisslj/muttjump
  2. https://notmuchmail.org/notmuch-mutt/
-- 
WebID: http://sebastian.tramp.name


Re: How do you survive without notmuch?

2016-04-08 Thread Andreas
On Thu, Apr 07, 2016 at 07:10:12PM -0500, Luis Mochan wrote:
> On Thu, Apr 07, 2016 at 10:50:13PM +0200, bastian-muttu...@t6l.de wrote:
> > On 07Apr16 19:53 +0200, Andreas wrote:
> > > Am 07.04.2016 um 01:19 schrieb Cameron Simpson:
> > ...
> > By now I cannot imagine any solution which is more flexible (for me).
> > Comments welcome!
> I do basically the same, with some scripts to add Xlabels to
> individual messages, instead of saving them in different
> mailboxes/maildirs. 
> > > Me too and while it does find the message it does not tell me /where/ it
> > > is. How do you do this?
> > 
> > I do not precisely know about notmuch, but the indexers I know about
> > they create links to the original mail in a temporary maildir folder. At
> > least follow those links.
> > Actually, to find the location of a mail file grepmail is a nice tool,
> > which I used long time ago.
> 
> I use maidir-utils. mu find can show you the actual location of a
> message if you use the option --fields "... l" as in
> 
>   mu find from:somefriend tag:somelabel --fields "d f s l"
> 
> which prints date, from, subject and location for each matching message.

Back then I compared mairix with notmuch and selected the latter for
reasons I cannot recall any more. As stated in another post mairix would
already return the location in the header.  

I am going to reevaluate my decision taking maildir-utils into account as a
third possibilty.

> Regards,
> Luis

Regards

Andreas