Helllo: I am trying to write a shell script to get the process id of a particular process (slapd) and then kill that using 'kill -9 $pid'.
I can get the pid by using prid= pidof slapd An echo of this for testing gives me the pid number followed by a blank line and then the prompt.
Now the problem is when I am trying to use this variable in various forms in the shell script and get errors.
option 1: kill -9 $prid
Output: 20685 kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
========================= Option 2: actual= "kill -9 $prid" echo $actual
Output: 20685 ./testscript: line 4: kill -9 : command not found
==========================
Option 3: actual="kill -9 $prid" echo $actual
Output: 20685 kill -9 #The process is still running.
Can you shed some light on where I am going wrong? Thank you very much. All help appreciated.
_________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/