Error while using getpid() is shell script

Hi,

I am trying to use getpid() in a k-shell script. However, the script is crashing as it is unable to recognise it as a function.

Please guide me on how to use it inside a shell script.

Try the pidof command.

Regards

pidof is not found... I am trying this on HP-UX Version 11/16/88

Please provide some info.

An alternative to get the pid of a program is:

ps -ef | awk '/name_of_your_program/ && !/awk/{print $2}'

getpid gives the current process id, right?

your shell script runs in a shell/ subshell/subsubsubsubshell

to get the pid of the current shell, type "echo $$"

Thanks a ton guys.. I used the $$... It works wonders!