I want to save the PID of a nohup process as part of the name of nohup's generated output file.
This is going in the right direction, but only works if the process with it's ID is already settled, i.e. only works at the next line. That means that it does not work, because it's the wrong PID (from the last command):
nohup echo "hello World" > nohup_out_`echo $!`.txt &
Is there any way to save the resulting PID in nohup's output filename?