Let's suppose I have a bash script (foo.sh
) that in a very simplified form, looks like the following:
echo "hello"
sleep 100 &
ps ax | grep sleep | grep -v grep | awk '{ print $1 } ' | xargs kill -9
echo "bye"
The third line imitates pkill
, which I don't have by default on Mac OS X, but you can think of it as the same as pkill
. However, when I run this script, I get the following output:
hello
foo: line 4: 54851 Killed sleep 100
bye
My question is thus: how I suppress the line in the middle so that all I see is hello
and bye
?