虽然粘贴进去也是可以, 但是长命令还是太慢了…

首先我们可以直接加上 “`”

➜  ~ echo "echo 123"|pbcopy
➜  ~ `pbpaste`
123

当然这种只能应对简单的命令, 针对复杂点的, 比如说包括需要转译的就爆炸.

所以可以使用 eval.

eval "$(pbpaste)"

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.