Pid in bash script filename?
How can i have a bash script use its pid number as part of a file name?
Thanks. Brian H |
can you please give us more details/some example?
|
A PID is assigned when the process is created i.e. when your script is executed and will not be the same if you run it again. Most services create a pid file which is deleted when it is stopped by the init system.
So can you explain why you want to use the PID as part of the file name? You can find its pid using the pidof command. |
The pid is $$ so you can create a filename as
Code:
FIL=$$.txt |
thanks SmallPond
Thanks SmallPond, that is exactly what I needed.
Cheers, Brian H. |
Glad you solved your problem, Uxhamby. :)
Could you please mark the thread as "Solved" (see "Thread Tools" at the top of the thread). Cheers. |
All times are GMT -5. The time now is 04:10 AM. |