I've a simple shell script that does something like this:
#!/usr/bin/bash
while read line; do
*prints menu*
*process 1* (e.g. pid=500)
sleep 2
*process 2* (e.g. pid=502)
*while process 1 is active*; do
sleep 1
kill -9 502
On the first while cycle, everything goes on the right place and if process 1
terminates before process 2
then it is killed. The problem is on the second cycle onwards: when the i-th cycle starts, it always prints something like this:
script.sh: line "n": 502 Killed ( python3 program_name argv[1] ecc...)
Anyone know how to avoid this print? The script should work (I checked with ps -a
and when pid 500 dies, pid 502 gets killed immediately) but that print is not elegant.