1

I want to call a zsh function, say wread, from an executable, say googler. googler is started in zsh (it’s a CLI app). I want googler to close itself and run wread in its parent shell. The reason I want to do this, instead of just running zsh -c “wread ...” in googler, is to avoid the shell startup time. (Also, wread uses the pager less to show its content, which I’d need to reimplement in googler if I use zsh -c).

I don’t want to put this function into its own script, because it uses other functions, and they are too entangled to be worth refactoring. And the whole point is to avoid sourcing a lot of functions for each invocation of googler.

I’ve read How to make my bash function known to external program, but it doesn’t answer my questions.

HappyFace
  • 1,612

0 Answers0