I have commands in a bash script that are similar to this:
eval "( java -classpath ./ $classname ${arguments[@]} $redirection_options $file )" &
pid=$!
However if I do a ps $pid
it shows the main script process instead of the process of the java program.
It obtains the correct process when I omit the eval, but in order to get some of the complicated arguments to work correctly I need to use it.
Any idea of how I can get the PID of the java program when it's executed within an eval command?