Pages

Friday, May 31, 2024

Bash Scripts amd Seq

Every time I write a bash script that requires floating point indexing, I forget the seq command. for z in $(seq 0 -.01 1) do echo $z done Darn useful and I hope writimg it dowmn wil burn it into permanent memory this time.

2 comments:

  1. syntax error...
    count from 0 to 1 in -.01 increments? you'll never get there.
    seq 0 .01 1 or seq 1 -.01 0 would work better... :)

    there are fancy ways to make brace expansion simulate decimals and using built-ins is almost always better but those are tougher to remember and the seq command and my mental filing cabinet is too full these days for goofy programming golf exercises...

    ReplyDelete