bash命令中!#:*!#:1-是什么意思? [英] What is the meaning of !#:* !#:1- in a bash command?
问题描述
在下面的Bash命令中,!#:* !#:1
In the following Bash command, what is the meaning of: !#:* !#:1
echo "This is a sentence." !#:* !#:1- >text3
推荐答案
它正在使用 bash的历史替换机制.
具体地说,!#
是指当前行(直到但不包括!#
本身的位置). !#:*
是该命令名称后该行的一部分(因此,在本例中为"This is a sentence."
). !#:1-
与!#:*
相同,除了它省略了最后一个单词(因此它不包括我们刚刚通过!#:*
添加的"This is a sentence"
的第二个副本).
Specifically, !#
refers to the current line (up to but not including the location of the !#
itself). !#:*
is the part of that line after the command name (so, in this case, "This is a sentence."
). !#:1-
is the same as !#:*
except that it omits the last word (so it doesn't include the second copy of "This is a sentence"
that we just added via the !#:*
).
最终结果是一行包含三个This is a sentence.
副本的行,回显到名为text3
的文件中.
The end result is a line with three copies of This is a sentence.
echoed into a file named text3
.
这篇关于bash命令中!#:*!#:1-是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!