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