Skip to main content
use code formatting to disambiguate quotation marks (two single quotes looked like misplaced double quote)
Source Link

You should use "trap true 2"trap true 2 or "trap : 2"trap : 2 instead of "trap '' 2"trap '' 2. That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

Example:

$ cat /tmp/test
#! /bin/sh
trap : INT
cat
echo first cat killed
cat
echo second cat killed
echo done
$ /tmp/test
   <press control-C>
^Cfirst cat killed
   <press control-C>
^Csecond cat killed
done

You should use "trap true 2" or "trap : 2" instead of "trap '' 2". That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

Example:

$ cat /tmp/test
#! /bin/sh
trap : INT
cat
echo first cat killed
cat
echo second cat killed
echo done
$ /tmp/test
   <press control-C>
^Cfirst cat killed
   <press control-C>
^Csecond cat killed
done

You should use trap true 2 or trap : 2 instead of trap '' 2. That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

Example:

$ cat /tmp/test
#! /bin/sh
trap : INT
cat
echo first cat killed
cat
echo second cat killed
echo done
$ /tmp/test
   <press control-C>
^Cfirst cat killed
   <press control-C>
^Csecond cat killed
done
added 297 characters in body
Source Link
user313992
user313992

You should use "trap true 2" or "trap : 2" instead of "trap '' 2". That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

Example:

$ cat /tmp/test
#! /bin/sh
trap : INT
cat
echo first cat killed
cat
echo second cat killed
echo done
$ /tmp/test
   <press control-C>
^Cfirst cat killed
   <press control-C>
^Csecond cat killed
done

You should use "trap true 2" instead of "trap '' 2". That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

You should use "trap true 2" or "trap : 2" instead of "trap '' 2". That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.

Example:

$ cat /tmp/test
#! /bin/sh
trap : INT
cat
echo first cat killed
cat
echo second cat killed
echo done
$ /tmp/test
   <press control-C>
^Cfirst cat killed
   <press control-C>
^Csecond cat killed
done
Source Link
user313992
user313992

You should use "trap true 2" instead of "trap '' 2". That's what "help trap" in a bash shell says about it:

If ARG is the null string each SIGNAL_SPEC is ignored by the shell and by the commands it invokes.