Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Store PID As a Variable??? 1

Status
Not open for further replies.

mwesticle

Programmer
Nov 19, 2003
51
US
I am writing a Korn Shell Script. In this script, I am performing multiple file manipulations, and generating various output files. I would like each output file to be named with the PID in the filename. For example, I'll run the script "myscript.ksh", and I want it to output three files, "outputfile1.7488.txt", "outputfile2.7488.txt", and "outputfile3.7488.txt", where "7488" is the PID. So in the script, I'll write the files out as outputfile1.${PID}.txt, outputfile2.${PID}.txt, and outputfile3.${PID}.txt. My question is how to get the variable "PID" to hold just the four digit PID. Any help, once again, would be greatly appreciated. Thanks to all.
 
Have you tried this ?
Code:
PID=$$
Anyway,
Code:
man ksh

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top