Re: Shell ( csh, sh ) scripting and seq-command
Dan, Bill, thank you, my bad for not reading the manpage thoroughly enough. i was put off by reps being the first parameter, and interpreted [s] ( stepsize ) as being the separator string, and assumed there was no stepsize. sorry for the fuzz, but at least i upped my shellscripting abilities :-) regards, usleep On 3/29/06, Dan Nelson <[EMAIL PROTECTED]> wrote: > In the last episode (Mar 29), [EMAIL PROTECTED] said: > > > You > > > should be able to write a shell script > > > > as i stated in my message, i lack shell scripting experience. > > > > > that wraps jot and provides > > > its functionality in the same format as seq. > > > > yes, and to convert steps to reps you will need $reps = ($end - > > $start) / $steps, and then see the difference between your script and > > the output of an actual linux seq. > > > > for example: > >seq 1 2 60 gives 1..3..5..7..59 ( see also my php and csh > implementations ) > > > > a seq equivalent ( 3 par version ) would be: > > > > @ reps = ( $3 - $1 ) / $2 > > jot $reps $1 $3 > > > > which will give 1..3..5..7..9..12(!)....60 > > > > so how would your implementation of seq by using jot look like? > > jot - $1 $3 $2 > > ( which in your case would be "jot - 1 60 2" ) > > -- > Dan Nelson > [EMAIL PROTECTED] > ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
In the last episode (Mar 29), [EMAIL PROTECTED] said: > > You > > should be able to write a shell script > > as i stated in my message, i lack shell scripting experience. > > > that wraps jot and provides > > its functionality in the same format as seq. > > yes, and to convert steps to reps you will need $reps = ($end - > $start) / $steps, and then see the difference between your script and > the output of an actual linux seq. > > for example: >seq 1 2 60 gives 1..3..5..7..59 ( see also my php and csh implementations ) > > a seq equivalent ( 3 par version ) would be: > > @ reps = ( $3 - $1 ) / $2 > jot $reps $1 $3 > > which will give 1..3..5..7..9..12(!)....60 > > so how would your implementation of seq by using jot look like? jot - $1 $3 $2 ( which in your case would be "jot - 1 60 2" ) -- Dan Nelson [EMAIL PROTECTED] ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
> You > should be able to write a shell script as i stated in my message, i lack shell scripting experience. > that wraps jot and provides > its functionality in the same format as seq. yes, and to convert steps to reps you will need $reps = ($end - $start) / $steps, and then see the difference between your script and the output of an actual linux seq. for example: seq 1 2 60 gives 1..3..5..7..59 ( see also my php and csh implementations ) a seq equivalent ( 3 par version ) would be: @ reps = ( $3 - $1 ) / $2 jot $reps $1 $3 which will give 1..3..5..7..9..12(!)....60 so how would your implementation of seq by using jot look like? regards, usleep On 3/29/06, Bill Moran <[EMAIL PROTECTED]> wrote: > On Wed, 29 Mar 2006 21:13:24 +0200 > [EMAIL PROTECTED] wrote: > > > jot != seq > > Equivalent, no. But it does offer comparative functionality. You > should be able to write a shell script that wraps jot and provides > its functionality in the same format as seq. > > -- > Bill Moran > Collaborative Fusion Inc. > ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
On Wed, 29 Mar 2006 21:13:24 +0200 [EMAIL PROTECTED] wrote: > jot != seq Equivalent, no. But it does offer comparative functionality. You should be able to write a shell script that wraps jot and provides its functionality in the same format as seq. -- Bill Moran Collaborative Fusion Inc. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
jot != seq but i found the seq in compat/linux. regards, usleep On 3/29/06, Bill Moran <[EMAIL PROTECTED]> wrote: > On Wed, 29 Mar 2006 20:43:43 +0200 > [EMAIL PROTECTED] wrote: > > > never mind! > > man 1 jot > > -- > Bill Moran > Collaborative Fusion Inc. > ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
On Wed, 29 Mar 2006 20:43:43 +0200 [EMAIL PROTECTED] wrote: > never mind! man 1 jot -- Bill Moran Collaborative Fusion Inc. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Shell ( csh, sh ) scripting and seq-command
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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Shell ( csh, sh ) scripting and seq-command
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 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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"