每当我必须从 web 执行 shell 脚本时curl -s [url] | sh,我首先url在我的 web 浏览器中打开以确保脚本不是恶意的并且可以安全运行。
我记得看到一个命令行技巧,可以从命令行读取脚本,然后在读取脚本后确认执行。如果我没记错的话,它看起来像curl -s [url] | something...here | sh并且不需要安装任何软件。
有人知道这个技巧吗?
我只是好奇,如果有办法从中获取输入不StdIn但是从$EDITOR-无论是Vim的纳米,emacs的,甚至非命令行编辑器(的MacVim / TextMate的)。有哪些选项/解决方法/最佳实践?
基本上我希望像这样的工作流程heredoc- 但是来自 $editor 。
$ sort -nr << FOO | uniq -c
pipe heredoc> foo
pipe heredoc> bar
pipe heredoc> baz
pipe heredoc> foo
pipe heredoc> FOO
2 foo
1 baz
1 bar
Run Code Online (Sandbox Code Playgroud)