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?

Recommended Answers

All 5 Replies

Not if you can't demonstrate the slightest bit of effort on your own.

What do you have so far? What specific questions do you have?

what useful information would need to be included?

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?

how would i incorporate the - a and - h features?

See getopts

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.