1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+__prompt_exit() |
|
2 |
+{ |
|
3 |
+ if [ "$3" -eq 0 ] |
|
4 |
+ then |
|
5 |
+ return 0 |
|
6 |
+ elif [ "$3" -lt 128 ] |
|
7 |
+ then |
|
8 |
+ printf "$1" "$3" |
|
9 |
+ else |
|
10 |
+ __prompt_exit_signal="$(kill -l "$(($3 - 128))" 2> '/dev/null')" |
|
11 |
+ if ! [ "$__prompt_exit_signal" ] |
|
12 |
+ then |
|
13 |
+ printf "$1" "$3" |
|
14 |
+ return 0 |
|
15 |
+ fi |
|
16 |
+ for __prompt_exit_signal_mask in $2 |
|
17 |
+ do |
|
18 |
+ if [ "$__prompt_exit_signal" = "$__prompt_exit_signal_mask" ] |
|
19 |
+ then |
|
20 |
+ return 0 |
|
21 |
+ fi |
|
22 |
+ done |
|
23 |
+ printf "$1" "$__prompt_exit_signal" |
|
24 |
+ fi |
|
25 |
+} |