![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regarding Shell Scripting | anilkarikkandar | UNIX for Dummies Questions & Answers | 3 | 11-19-2006 09:26 PM |
| HELP PLS!! Shell Scripting!! | Mary_xxx | Shell Programming and Scripting | 9 | 09-16-2006 03:52 AM |
| difference between AIX shell scripting and Unix shell scripting. | haroonec | Shell Programming and Scripting | 2 | 04-12-2006 05:12 AM |
| something else on shell scripting | master_6ez | Shell Programming and Scripting | 1 | 11-21-2004 08:42 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi everyone.. i'm a noob on shell programming and am doing some scripting.. but i really have a lot of trouble getting started.. i need to write a simple shell scripting.. it goes something like this..
for eg if i press '1', it'll show processes for the current user namely - process id - parent process id - user name - command - CPU utilization (in desc) - process start time - process status and output it to a file named whatever.txt.. if i press '2' it reports those processes selected in (1) with CPU utilization not equal to 0 if i press '3' it displays all the child processes (with process id, command) of the user specified process if i press '4' it kills all the process with specified program(command) name on behalf of the user can all these be done..? argh.. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
It looks like if it were a homework!
|
|
#3
|
|||
|
|||
|
it's considered more as a 'challenge'.. =D my friend showed me what he could do with bash and it seems fun so i'd like to see if i can do it myself.. but it's my first time hands on at bash.. so i need a like you know 'headstart'..?
|
|
#4
|
||||
|
||||
|
yes, everything you want, can be done! it's a lot of work but you will learn a lot of usefull things...
good luck... p.s. have a look at the output of "ps -ef" for a nice processlist and if you pipe it and "grep" for a username... should be a good start |
|
#5
|
|||
|
|||
|
Why not ask your "friend" how he did it? The first thing to do is break open the manual for the operating system you are using and read the system commands it has available. Like the one DukeNuke2 mentions above. What you need do from there is write some shell code to run the commands, grab the output and parse it for the specific data you are interested in and display it however you want. If you are a good learner you will have something written by the end of the day.
|
|
#6
|
|||
|
|||
|
#!/bin/bash
here u go.. headstart.. |
|
#7
|
|||
|
|||
|
the "friend" that gave you this challenge = your teacher ?
you might want to play around with pipe, redirection, sed, grep, awk, those should be able to help you, read up especially on their manuals. Last edited by faifai; 02-03-2008 at 09:29 AM. |
|||
| Google The UNIX and Linux Forums |