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 Scripting

Discussion in 'Software Development' started by ddeery13, Dec 12, 2011.

Thread Status:
Not open for further replies.
  1. ddeery13

    ddeery13 Thread Starter

    Joined:
    Nov 20, 2011
    Messages:
    6
    I need help writing a script called stats, which provides the user with useful information about the status of their system. The user should run this by typing stats at the command prompt. The output should be displayed immediately on stdout . Anyone able to help me?
     
  2. ddeery13

    ddeery13 Thread Starter

    Joined:
    Nov 20, 2011
    Messages:
    6
    i also have another question -
    Write a script called area which takes two numerical arguments representing the base length and height of a right-angled triangle, plus one or two options, -a, and –h meaning area and help.
    Wiih option –a, the area of the triangle should be displayed on standard output preceded by the message ‘Area is: . With option –h, a short help message should be displayed. With no options there should be no output. Any other option should be ignored except that a warning ‘invalid option’ should be output.

    for that one, i have the following so far -

    echo –n “Enter base of a triangle : ”
    read b
    echo –n “Enter height of a triangle : ”
    read h
    area = $ (echo “scale=2; (1/2) * $b * $h |bc)
    echo “Area of a triangle is $area”

    how would i incorporate the - a and - h features?
     
  3. buffoon

    buffoon

    Joined:
    Jul 16, 2008
    Messages:
    19,165
    As stated before, we don't assist with homework. It's strongly advised that you desist from posting any more of this kind.

    Closing this.
     
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/1030935

  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