Hacker News new | ask | show | jobs
by daxterspeed 2406 days ago
Is there a simple command you can use to read the contents of the script (pipe) before it's sent to sh? Something like:

    curl ... | less-and-maybe-cancel | sh
3 comments

Yeah, "vipe" from moreutils (which is a package on most platforms) does this. It inserts $EDITOR (usually vim) into the command pipe, and allows you to review and/or edit the text before passing it on to the next thing in the pipeline. Great little command line utility, for all sorts of things.

If you want to cancel, just erase the file. Or `:cq` in vim probably works as well.

You can pipe the output of cURL to Vim like this:

  curl ... | vim -
Then, you can review the script, maybe tweak it a little, and you can send it to sh's stdin by running

  :w !sh
Or you can just quit Vim (:q! or ZQ) and nothing happens.
The Maybe command sounds similair.

https://github.com/p-e-w/maybe