led*_*awg 5 bash line-editor command-substitution
我在 bash shell 上,我希望命令的输出直接出现在命令执行后出现的命令提示符中!
我设想的示例,以说明我的想法:
locate create_tables.sql|MAGIC_command
user@localhost:~# /usr/share/doc/phpmyadmin/create_tables.sql
Run Code Online (Sandbox Code Playgroud)
现在,像这样使用 comman dsubstitution
sudo $(locate create-tables.sql)
Run Code Online (Sandbox Code Playgroud)
工作但 立即执行输出,我希望能够之前编辑它。有办法吗?
不是很优雅的解决方案是将输出存储到某个 tmpfile 中,编辑该文件,然后运行:
$ locate create_tables.sql > /tmp/tmpfile
$ vi !$ # last argument of last command
$ bash !$
Run Code Online (Sandbox Code Playgroud)