Just brain storming... could another possible solution be to create a public list of hashes of well known scripts, and then write a small `sh` wrapper that verifies that hash of the script it's about to execute?
When I used to work on windows I created a little AutoHotKey script that remapped my keyboard when ever the capslock key was on:
https://github.com/xavi-/Keyboard-Remapper
It mapped I,J,K,L to the arrow keys, U to the home key, O to the end key, N to backspace, M into the del, and etc... Did wonders for my wrists.
Yep, that is exactly the solution I would be looking for.
I would be blown a way if someone came up with solution that could handle arbitrary function returns. My friend actually wrote an interesting article on the subject. Here's the link if you're interested: http://msdn.microsoft.com/en-US/scriptjunkie/gg575560.aspx
Many interviewees, when presented with `say("hello")("world")`, understood that `say` was a function that returned a function, but few were able to actually implement `say`.