in reply to how to get which user is on

Exactly what do you mean by "PID of any program"?

The PID of the current process if given by special var $$ ... but I'm not sure that's what you want...