I run a script like:
sleep 20 &
PID=$!
kill -9 $PID >/dev/null 2>&1
I dont want the script show the output like:
line 51: 22943 Killed sleep
I have no idea why this happen, I have redirect the output to /dev/null
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The message isn’t coming from either
killor the background command, it’s coming from bash when it discovers that one of its background jobs has been killed. To avoid the message, usedisownto remove it from bash’s job control: