Sample Header Ad - 728x90

Why can't I use `kill $!` with parameter expansion in Bash, when the most recent process is "notify-send"?

2 votes
1 answer
336 views
According to Bash: [Special Parameters](https://unix.stackexchange.com/a/218271/66803) : >($!) 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.
Asked by Pandya (25613 rep)
Apr 2, 2016, 08:45 AM
Last activity: Jun 14, 2021, 03:59 AM