1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

shell script Command line help please

Discussion in 'Software Development' started by bossman5000, Nov 19, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. bossman5000

    bossman5000 Thread Starter

    Joined:
    Nov 9, 2011
    Messages:
    8
    Write a shell script that will accept any number of command line interger parameters do the following....I have to use a if statment for the lowest and highest values???

    first question-----Determind the lowest and highest values?
    second question------Determind the sum of all parameters entered??



    for num in $*

    do

    if [ num -lt lowest}
    then
    echo " The low number is : $num"
    fi
    if { $num -gt high ]
    then echo "High num is: $num"
    fi

    How
     
  2. Elvandil

    Elvandil

    Joined:
    Aug 1, 2003
    Messages:
    51,988
    Shouldn't you do your own homework?
     
  3. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    You never assign anything to the variables lowest or high. You should probably loop through all your input before you echo the output.
     
  4. bossman5000

    bossman5000 Thread Starter

    Joined:
    Nov 9, 2011
    Messages:
    8
    min= 999999
    max= -999999

    what do i do next Squashman???
     
  5. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    You have the loop setup in your 1st post. What aren't you understanding?
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1027647

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice