|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help with shell script
How would I write a shell script called pidof which takes a name as parameter and outputs the PID(s) of processes with that name? I know that ps -C $1 would work on a command line, but how would I write a shell script with a parameter that does this? I am using Bourne shell (sh).
|
|
#2
|
||||
|
||||
|
ps auxww | grep "{$1}" | awk '{print $2}' maybe? Change the ps line to something suitable for your OS.
__________________
FreeBSD Admin Tips Tricks and Scripts |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Help with shell script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|