Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2006 19:53:10 +0200
From:      usleepless@gmail.com
To:        freebsd-questions@freebsd.org
Subject:   Shell ( csh, sh ) scripting and seq-command
Message-ID:  <c39ec84c0603290953n2819ef36j30d523537a093827@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Dear List,

i have prototyped a subset of the linux seq command in php ( ouch, yes. ). =
why?

i don't know how to do it in any shell-script. i have been reading
man-pages, searching google, but years later, i still can't do a thing
in them. maybe it is my blindspot. here it goes ( without the tags etc
):

#!/usr/local/bin/php
<?php
        // 2 pars: $1 =3D start $2 =3D end ( $0 is exe-path, right? )
        if($argc =3D=3D 2 + 1)
        {
                for($i=3D$argv[1]; $i<=3D$argv[2]; $i++)
                        echo "$i\n";
        }

        // 3 pars: $1 =3D start $2 =3D step $3 =3D end
        if($argc =3D=3D 3 + 1)
        {
                for($i=3D$argv[1]; $i<=3D$argv[3]; $i+=3D$argv[2])
                        echo "$i\n";
        }
?>

i would appreciate any implementations in csh, sh or bash or whatever.
maybe i will learn.

csh or sh would be the most interesting though. this code is trivial
to implement in C, that is not my problem.

regards,

usleep



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c39ec84c0603290953n2819ef36j30d523537a093827>