Pipe to register?

Is it possible to have the output of a pipe go into a register – namely, the copy register – instead of replacing the current selections?
An example of what I want to do is to pipe a math expression to bc, and then paste it elsewhere (e.g. after an equals sign).

I know I could do exec '|bc<ret>yup', but I don’t like how that adds to the undo-history.

:reg <my-register> %sh{echo "$kak_selection" | bc} should do the trick.

That worked.
Here is my basic BC math operator (based on wiki page):

# general math prompt to operate on selection (using bc)
define-command -params 0..1 -docstring "calculate math expression with bc. additional expressions as optional arg." \
math-bc %{
    set-register \" %sh{ echo "$kak_selection$1" | bc }
}
map global normal = ': math-bc<ret>' -docstring "math eval"
map global normal <a-=> ':prompt math: %{ math-bc "%val(text)" }<ret>' -docstring "math prompt"

Do you know how I could get this to work on multiple selections, like with eval -itersel?