Solaris problem

I am using the parameter below for creating a log of garbage collection.

-verbose:gc -Xloggc:/opt/bea/GCfiles/gc.$$

In the log name "gc.$$" would fetch the PID and create the log with that name as gc.PID

It is working in Linux. But failing in Solaris.

The "$$" is not fetching the PID in solaris. What do I do?
RazAsked:
Who is Participating?
 
RazConnect With a Mentor Author Commented:
On solaris, $$ will give output only if it is run manually. It doesnt work when it is being run as a script for naming the log.
0
 
omarfaridCommented:
what shell are you using on both linux and solaris? can you run your script in debug mode?

if you run

echo $$

on solaris, what do you get?
0
 
RazAuthor Commented:
im using bash.

echo $$ gives the PID on both Linux and solaris.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
omarfaridCommented:
so, where this is failing?
0
 
RazAuthor Commented:
In solaris,
If I put the parameter as

-verbose:gc -Xloggc:/opt/bea/GCfiles/gc.log

the log is creating as gc.log.

Bot if I put "gc.$$" the file is creating in an un readable format (currupted).
0
 
omarfaridCommented:
is it the filename that is corrupted or the file content?
0
 
RazAuthor Commented:
file name is coming as gc.$$ (as it is). file content is getting corrupted
0
 
omarfaridCommented:
can you remove " around $$ ?
0
 
RazAuthor Commented:
I didnt put quotes to it.
0
 
omarfaridCommented:
is this part of a script? if so, then can you share sample script?
0
 
RazAuthor Commented:
The comments by omarfarid are not helpful. I have found the solution myself. In solaris it doesnt work while naming the log.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.