外壳感叹号命令 [英] Shell exclamation mark command

查看:72
本文介绍了外壳感叹号命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此命令的作用是什么?

!g++

对于历史命令:

!12

它运行历史记录的命令#12,但是 g ++ 或另一个:

It runs command #12 of the history, but what about g++, or another:

!cat filename


推荐答案

请参见庆典手册,事件指示符


!string

请参阅历史记录列表中当前位置之前的最新命令,从 string 。

Refer to the most recent command preceding the current position in the history list starting with string.

这意味着!g ++ 运行最后一个以 g ++ ,调用GNU C ++编译器:

This means that !g++ runs the last command that began with g++, calling the GNU C++ compiler:

$ g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
...
(g++ does its job here)
...
$ vim test
...
(other commands)
...
$ !g++
g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran  <-- same command as before

相同的命令!另一方面,cat文件名并没有多大意义,因为它已经是一个完整的命令。当然,除非最后一次在该命令之后有一个超级复杂的管道,否则事件指示符将重复该管道。

!cat filename, on the other hands, doesn't make a lot of sense as it's already a complete command. Unless there was a super complicated pipe after that command the last time, of course, which the event designator would then repeat.

这篇关于外壳感叹号命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆