[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] refile and moving sequences with messages

From: Robert Elz
Subject: Re: [Nmh-workers] refile and moving sequences with messages
Date: Fri, 15 Mar 2013 08:07:31 +0700

    Date:        Thu, 14 Mar 2013 11:21:32 -0700
    From:        Kevin Layer <address@hidden>
    Message-ID:  <address@hidden>

  | #! /bin/bash

I see nothing in this that requires bash, so to make it more portable
you should probably just use /bin/sh

  | prefix=$(mhpath +inbox | sed 's,/inbox$,,')

This is just            prefix=$(mhpath +)

  | to=$(echo $2 | sed -e "s|^$prefix/||")

And in any reasonably modern shell (certainly including bash)
this is just
(and much the same for the assignment to "from" slightly lower).

  |     fromf=$(echo $from | sed -e 's,\(.*\)/\(.*\),\1,')

And this one could be
(and similar for others using the same pattern).

In general, it is rarely necessary (unless your regular expression is
truly complex) to ever do "echo thing | sed" these days, and much safer
in case "thing" has any meta characters (like folders with spaces in their

  |     fromm=$(echo $from | sed -e 's,\(.*\)/\(.*\),\2,')

This one is (I think)

  |         # Need to set the current folder back to $fromf!

You might want to consider folder -push and folder -pop to
better accomplish this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]