procmail
[Top] [All Lists]

Re: tail and procmail

2009-11-16 00:43:42
On Sun, Nov 15, 2009 at 6:04 PM, JW Simpson <john(_at_)swajime(_dot_)com> wrote:
VAR1=`ls -l`
VAR2=`tail -1 <<< "$VAR1"`

That might work for versions of bash/ksh/zsh released in the last 3
years or so.  If you happen to have something older, you need

VAR2=`echo "$VAR1" | tail -1`

The double-quotes should assure that the newlines in the value of
$VAR1 are preserved (JW's answer relies upon that as well).

Oh, and make sure LINEBUF is set large enough to contain the entire
output of "ls -l" or you'll get very unexpected results.
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>