How can I access the "selected_text" variable from Shell script?

the variable is now available - also from javascript you can easily run shell scripts like described here: Using Java Script (not JXA) · GitBook