Getting and use the true PID of a installed programm like xed or Firefox are working fine p.e. on follow way:
#!/bin/bash
xed & PID=$! # Start xed and get PID for later
echo "$PID"
Running the xed some time
kill -15 "$PID" # Soft Kill of xed
Getting the PID of portable TOR browser give back a PID which looks like are not from TOR browser (possible from one of a TOR helper scripts inside the portable Tor browser folder)
The result of this is. The Tor browser cant be closed on follow way by the wrong TOR PID:
#!/bin/bash
/home/username/desktop/Tor_FF/start-tor-browser.desktop & PID=$! # Start xed and get PID for later
echo "$PID"
Running the xed some time
kill -15 "$PID" # Soft Kill of xed
Envirement:
Based on input from Socowi, follow solution:
#!/bin/bash
TOR_PID=$(pgrep -o firefox.real); echo "$TOR_PID"
# running TOR a little bit
kill -15 "$TOR_PID" # Soft Kill of xed
Check onetime by hand what the name of the Tor process is by:
Get the PID by processname:
TOR_PID=$(pgrep -o firefox.real); echo "$TOR_PID"
Doublecheck by the follow the PID are realy the right one from TOR:
Check the PID by follow:
kill -15 "$TOR_PID" # Soft Kill of TOR browser