LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   simple bash script (https://www.linuxquestions.org/questions/linux-newbie-8/simple-bash-script-866900/)

bigbada 03-07-2011 02:57 AM

simple bash script
 
Write a Bash script that displays the system status according to:
- CPU,
- storage,
- disk,
- network.
The script should use a basic commands of the Linux operating system and builds a simple dashboard including as much information as possible. The system data should be saved into script variables or arrays.

Can any1 help me to do this ?

We must use: man, find, cut, sort, tee, echo, wc, ps, grep, whoami.

awk and sed is prohibited.

acid_kewpie 03-07-2011 02:58 AM

No! We aren't going to do your homework for you! That's called "Cheating". Do your best and if you have ***SPECIFIC*** questions then please ask again.

repo 03-07-2011 02:59 AM

Quote:

We must use: man, find, cut, sort, tee, echo, wc, ps, grep, whoami.
Perhaps you can start with
Code:

man find
man cut
man sort
man tee
man echo
man wc
man ps
man grep
man whoami

Kind regards

bigbada 03-07-2011 03:04 AM

This is no homework. I readed all the manuals for the commands, but even know i dont know how to start
How to display system status for CPU and so on ? I dont find the command

acid_kewpie 03-07-2011 03:07 AM

Please don't insult our intelligence, there is NO WAY this is not an assignment. You've pasted it in verbatim, and evn put in comments about certain commands not being allowed, which is SUCH a giveaway it's unreal.

bigbada 03-07-2011 03:10 AM

I say it again! Its not a homework. Its just a personal matter! If u dont believe me then nothing. I asked nicely, cuz i dont know what to do, and this is what i get. Such a kindness really.

repo 03-07-2011 03:15 AM

Quote:

How to display system status for CPU
http://www.google.be/search?q=linux+...ient=firefox-a
http://tldp.org/LDP/Bash-Beginners-G...ers-Guide.html

Kind regards

acid_kewpie 03-07-2011 03:47 AM

if this was my personal issue, then my solution would probably have awk and sed all over it. Would that be OK? If not, why not?

bigbada 03-07-2011 03:54 AM

No, i wanna learn it without awk/sed

I have another question.
I did
cat /etc/passwd | grep "/home" | cut -d: -f1 |
bla
blabla
blablabla
cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w
3
that counts the words
now i wanna print into echo this counted number.. how i do that?
echo "number of counted words are %d(the wc -w count must be here) " ??

grail 03-07-2011 08:04 AM

How about you solve one problem at a time. You claim it is not homework, so i will believe you for now. Show us what you have done so far and we will assist?

So far the only help I would give is that nearly everything you have asked when searched in google seems to have many, many responses.

120 03-07-2011 08:38 AM

Perhaps the OP misses the fact that this very same set of questions/homework have been posted here before. Nobody much warms to helping a liar.

szboardstretcher 03-07-2011 08:38 AM

Quote:

Originally Posted by bigbada (Post 4281297)
No, i wanna learn it without awk/sed

I have another question.
I did
cat /etc/passwd | grep "/home" | cut -d: -f1 |
bla
blabla
blablabla
cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w
3
that counts the words
now i wanna print into echo this counted number.. how i do that?
echo "number of counted words are %d(the wc -w count must be here) " ??

Code:

someoutput=`cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w`
echo "dum de dum de dum $someoutput dum de de de"


TB0ne 03-07-2011 03:16 PM

Quote:

Originally Posted by bigbada (Post 4281262)
I say it again! Its not a homework. Its just a personal matter! If u dont believe me then nothing. I asked nicely, cuz i dont know what to do, and this is what i get. Such a kindness really.

No, I don't believe you. The original question was phrased EXACTLY like a homework question would be. Saying also "we must use xxxx", says that it's an assignment, rather than just a random question.

If it WAS a random question, you'd just ASK it, and say "How could I monitor CPU with a bash script?", and not worry about the command(s) used to do it. And spell out your words....that text speak garbage isn't a good thing to post in.


All times are GMT -5. The time now is 06:46 PM.