Skip to content

How to get the PID in current bash shell script

How to get the PID in current bash shell script

Answer:

Use the special variable $$, you can get the PID (Process ID) of the current bash shell script

#/bin/bash

echo $$;

The above script will print the PID to the standard out.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  1. How to perform syntax check on a bash script?
  2. How to check the bash shell version
  3. Convert IP address to HEX in Bash script
  4. How to make shell script run in low priority
  5. How to unset an environment variable in bash

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*