[plug] Posix, Fedora 5 and tail

Carl Gherardi carl.gherardi at gmail.com
Mon Jul 17 16:34:03 WST 2006


On 7/17/06, ZoMBiE <evilzombie at gmail.com> wrote:
> On 17/07/06, Carl Gherardi <carl.gherardi at gmail.com> wrote:
> > Still good
>
> What I meant was, why bother with the export part when youcan just use
> -n, much less typing :-)

Ahhh...

The script I hit this on is a variable length log, and I to parse
everything after a set of summary headers.

This pops up occasionally in 3rd party install scripts that do silly
things like (and I quote):

skiplines=97
checksize='13137920'
checkcksum='1440380517 13137920'

Extract()
{
    tail "+$skiplines" "$0"
}

CheckMe()
{
    if type cksum >/dev/null 2>&1; then
        c=`Extract | cksum`
        c=`echo $c`
        [ "$checkcksum" = "$c" ] && return 0
    elif [ $checksize -eq `Extract | wc -c` ]; then
        return 0
    fi
    echo "Error: $0 appears to be corrupted" >&2
    return 1
}

CheckMe || exit

Where after line 97 is a binary tarball

I've got three install scripts from different vendors which all do
something similar. (checksum, cat license agreement, install)

Carl G



More information about the plug mailing list