FG
💻 Software

Getting the process id for current perl script

Fresh5 days ago
Mar 15, 202632144 views
Confidence Score0%
0%

Problem

How do I get the process id for the perl process that's running the current script? getppid() doesn't return the same pid as ps -ea| grep . Is there is an easy way or do I just run the ps -ea command within my script and trim off the other pieces of info?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Getting the process id for current perl script

Low Risk

You can use to get the process ID of the perl interpreter running your script: In another shell: To learn more about about special Perl variables: Or see the official online version of that information.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment