From c776414674feb0cba4a2b3c91d01cded2c821ed7 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 27 Jan 2019 14:20:56 +0100 Subject: [PATCH] functions/trap: Don't `test` with one argument That's a POSIX misfeature. Also there was one actually wrong `test sig` that should have been `test $sig`. --- share/functions/trap.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/functions/trap.fish b/share/functions/trap.fish index 119cdc1c3..fab5cd952 100644 --- a/share/functions/trap.fish +++ b/share/functions/trap.fish @@ -54,7 +54,7 @@ function trap -d 'Perform an action when the shell receives a signal' case clear for i in $argv set sig (__trap_translate_signal $i) - if test $sig + if test -n "$sig" functions -e __trap_handler_$sig end end @@ -67,7 +67,7 @@ function trap -d 'Perform an action when the shell receives a signal' set -l sig (__trap_translate_signal $i) set sw (__trap_switch $sig) - if test $sig + if test -n "$sig" echo "function __trap_handler_$sig $sw; $cmd; end" | source else return 1 @@ -85,7 +85,7 @@ function trap -d 'Perform an action when the shell receives a signal' for i in $names set sig (__trap_translate_signal $i) - if test sig + if test -n "$sig" functions __trap_handler_$i else return 1