From 962f9914c61f6ab0e744009cafa56d072bbfc8a6 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 3 Feb 2016 23:23:04 +0100 Subject: [PATCH] Stringify trap --- share/functions/trap.fish | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/share/functions/trap.fish b/share/functions/trap.fish index 47f39c972..094d37f1b 100644 --- a/share/functions/trap.fish +++ b/share/functions/trap.fish @@ -1,11 +1,7 @@ function __trap_translate_signal set upper (echo $argv[1]|tr a-z A-Z) - if expr $upper : 'SIG.*' >/dev/null - echo $upper | cut -c 4- - else - echo $upper - end + string replace -r '^SIG' '' -- $upper end function __trap_switch @@ -124,7 +120,7 @@ function trap -d 'Perform an action when the shell receives a signal' if count $opt >/dev/null set names $opt else - set names (functions -na| __fish_sgrep "^__trap_handler_"|sed -e 's/__trap_handler_//' ) + set names (functions -na| string match "__trap_handler_*" | string replace '__trap_handler_' '') end for i in $names