Date: Thu, 14 Mar 2013 11:21:32 -0700
From: Kevin Layer <layer(_at_)known(_dot_)net>
Message-ID: <30364(_dot_)1363285292(_at_)relay(_dot_)known(_dot_)net>
| #! /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
to=${2#${prefix}/}
(and much the same for the assignment to "from" slightly lower).
| fromf=$(echo $from | sed -e 's,\(.*\)/\(.*\),\1,')
And this one could be
fromf=${from%/*}
(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
names...)
| fromm=$(echo $from | sed -e 's,\(.*\)/\(.*\),\2,')
This one is (I think)
fromm=${from##*/}
| # Need to set the current folder back to $fromf!
You might want to consider folder -push and folder -pop to
better accomplish this.
kre
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers