Shell ( csh, sh ) scripting and seq-command

usleepless at gmail.com usleepless at gmail.com
Wed Mar 29 18:43:45 UTC 2006


never mind!

#!/bin/csh

if ($#argv == 2) then
        @ start = $argv[1]
        @ end  = $argv[2]
        @ i = $argv[1]

        while ( $i <= $end )
                echo $i
                @ i = $i + 1
        end
endif

if ($#argv == 3) then
        @ start = $argv[1]
        @ end  = $argv[3]
        @ step = $argv[2]
        @ i = $argv[1]

        while ( ($step>0 && $i <= $end) || ($step<0 && $i >= $end) )
                echo $i
                @ i = $i + $step
        end
endif



More information about the freebsd-questions mailing list