Executing Ps in script

Im Sorry to bother you guys butim totally new to Unix, so pls help me out if you can. This could be a silly question.

I wanna run the command "ps" in script, but how should I be able to do so? Actually I have made a menu for the user to choose from...for example

  1. Show all processes
  2. Kill process
    .
    .
    .
    N. XXX

I want to get it done when the user chooses option one and it will show him the processes currently running.

Thx!

You can check out <a href="Menu driven using Ksh"><b>this</b></a> thread for more information on menus... Also, check out the <a href="Advance Search"><b>search</b></a> funtion for more examples. I searched for "menu case" to get the above example.

Keep in mind that since the output of the `ps -e` command is usually longer than one screen, you might want to pipe it through `more` or `less` for the user, if you use those options.

ps -e | more

See the manual page for `ps` (man ps) for more information on formatting.

BTW, hope this isn't a h:pmework question... those are frowned upon.