Closed cstyles closed 5 years ago
You can achieve the same with:
$ myvar=$(python3 nvr/nvr.py --remote-expr 'getreg()')
$ python3 nvr/nvr.py --remote-expr "setreg('\"', '$myvar')"
The quoting here isn't too complicated and I'm reluctant to add yet another way to do something similar only slightly more convenient. We have enough options already. :) Especially since this new way would only work for single function calls.
But I understand the quoting problem if you have mixed '
and "
. It gets a bit more complicated then:
$ setreg() { nvr --remote-expr "setreg('\"', '$(echo "$@" | sed "s|'|''|g")')"; }
$ setreg $myar
Would it be good enough if this example gets added to the FAQ?
This PR adds the ability to call a function directly. For example:
or conversely:
Currently, you'd have to use something like
-c 'call setreg(...)'
which can be tricky to get working with quotes and backslashes and whatnot.