You can extract the debug port with sed
:
ps -fu ${USER} | grep address | sed 's/.*address=\([0-9]*\).*/\1/'
Update:
The output from ps
may include the grep
command itself. You can use grep
again to filter that out:
ps -fu ${USER} | grep address | sed 's/.*address=\([0-9]*\).*/\1/' | grep ^\d