According to Bash: Special Parameters:
($!) Expands to the process ID of the job most recently placed into the background, whether executed as an asynchronous command or using the bg builtin
I can utilize this as follows:
$ leafpad &  3962 $ kill $!
This works and kills the most recent process (eg.
leafpad) but for
notify-send it seems not working:
$ notify-send Hello &  4052 $ kill $! bash: kill: (4052) - No such process
And I have to use
killall notify-osd in order to kill it.
So, I want to know why
kill $! doesn't work for
notify-send? And what is the proper way to kill such a process?
Note: I know that I can specify the time-out, but this is a different issue.