I am trying to get ProcessId of the same process from which I am running the pgrep command. But the InputStream is returning null.
If we run command pgrep terminal
from terminal in mac we cant get the processid of terminal. but if we run lsappinfo command in terminal and search for terminal it is there along with the processid.
I want to get processId of the same process from which I am running the command, Is there any other efficient way to get processId from process name like that of pgrep.