Shell ( csh, sh ) scripting and seq-command
usleepless at gmail.com
usleepless at gmail.com
Wed Mar 29 17:53:12 UTC 2006
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 = start $2 = end ( $0 is exe-path, right? )
if($argc == 2 + 1)
{
for($i=$argv[1]; $i<=$argv[2]; $i++)
echo "$i\n";
}
// 3 pars: $1 = start $2 = step $3 = end
if($argc == 3 + 1)
{
for($i=$argv[1]; $i<=$argv[3]; $i+=$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
More information about the freebsd-questions
mailing list