In bash, the variable "$$" contains the pid of the current bash process, while "$PPID" contains the pid of the parent process, so which one to use depends on how you execute the script. A login shell is not unique in the system, maybe these commands are what you need.
If you don't have execute permissions on a script, say it is /usr/bin/zless, then launch it as "sh /usr/bin/zless". Another way is reading it (cat /usr/bin/zless > /tmp/zless), giving it execute permissions (chmod +x /tmp/zless), and executing it directly (/tmp/zless). Using this second way you don't need to know which is the right interpreter for the script, as the system itself will find it out.