I am running this script docker-maintenance-script.sh. I want to check if the same clone(s) of program(my script) is running on machine. So I am running a ps command inside the script which greps again docker-maintenance-script.sh.
ps -ef | grep -P "(?<!(grep))(docker\-maintenance\-script\.sh)" 
output while running the script was:
dxadmin   4497  5231  0 22:32 pts/0    00:00:00 bash -x docker-maintenance-script.sh
which is only infact this current proceess that is greping.
So to the problem -
I want to discard that entry as that is invoker process. I need ps list that only lists other docker-maintenance-script.sh process. not this process.
I need a ps list that discards my current parent pid based on negative look behind usinf pid.
I tried this
ps -ef | grep -P "(?<!(grep))(?<!($$))(docker\-maintenance\-script\.sh)"
($$ returns current pid of process)
in this case 4497. But that is not helping as it 'not match' only  when its just right before
(docker-maintenance-script.sh). I want to not match the string whenever
$$ appears anywhere before (docker-maintenance-script.sh). Please Help
I tried too ps -ef | grep -P "(?<!($$.*))(docker\-maintenance\-script\.sh)"
but that returns non-fixed length lookbehind grep error
