Stringify trap

This commit is contained in:
Fabian Homborg 2016-02-03 23:23:04 +01:00
parent df8c4ce835
commit 962f9914c6

View file

@ -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