help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] How to forbidden SIGINT be propagated from the parent script


From: Peng Yu
Subject: [Help-bash] How to forbidden SIGINT be propagated from the parent script to the child script?
Date: Fri, 29 May 2015 00:23:24 -0500

I have the following scripts.

==> main.sh <==
#!/usr/bin/env bash

trap "echo in $0 SIGINT" SIGINT
while true
do
  ./script.sh
done


==> script.sh <==
#!/usr/bin/env bash

trap "echo in $0 SIGINT" SIGINT
echo "Start $0:$$"
sleep 10 &
wait
echo "Finish $0:$$"

The following shows that SIGINT is propagated to ./script.sh. Is there
a way to prevent ./script.sh from receiving SIGINT in ./main.sh

$ ./main.sh
Start ./script.sh:2868
^Cin ./script.sh SIGINT
Finish ./script.sh:2868
in ./main.sh SIGINT
Start ./script.sh:2870

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]