Looping and Skipping

Sort by

recency

|

250 Discussions

|

  • + 0 comments
    for((i=1;i<=99;i=i+2))do
        echo $i;
    done
    
  • + 1 comment
    #!/bin/bash
    for i in {1..100}; do
    if [ `expr $i % 2` != 0 ];
    then echo $i
    fi;
    done
    
  • + 0 comments

    i=0; for((i=1; i<=99; i++ )) do if (( i%2 != 0 )) then echo $i fi

    done

  • + 1 comment

    just

    for i in {1..99..2}; do echo $i; done

  • + 0 comments
    i=1
    while [ $i -le 99 ]
    do
    echo $i
    i=$((i+2))
    done