Find the answer to your Linux question:
Results 1 to 2 of 2
hello i am trying to write a program where it counts up to 5 in bash and if the number gets higher then 5 then echo on screen number is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2004
    Posts
    1

    questions


    hello i am trying to write a program where it counts up to 5 in bash and if the number gets higher then 5 then echo on screen number is to high

    Thankx bye

  2. #2
    Linux Newbie
    Join Date
    Apr 2004
    Location
    Stockholm, Sweden
    Posts
    130
    Was that a question????

    #!/bin/bash

    for number in $(seq 0 6)
    do
    if [ $number -lt 6 ]
    then
    echo $number
    else
    echo "Number is too high"
    fi
    done

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •