什么符号 - ,&LT;和大于意思? [英] What do the symbols -, < and > mean?
问题描述
我在书上读到这个例子:
I read this example in a book:
cp /bin/cat proj33
echo -n x | ./proj33 - pipe33a > pipe33b &
./proj33 <pipe33b >pipe33a &
什么符号 -
,&GT;
和&LT;
是什么意思?
推荐答案
的&GT;
是I / O重定向;它发出的指令( ./ proj33
)的标准输出到文件 pipe33b
。
The >
is I/O redirection; it sends the standard output of the command (./proj33
) to the file pipe33b
.
的&LT;
符号也是I / O重定向;它从文件发送命令的标准输入( ./ proj33
再次) pipe33b
。
The <
symbol is also I/O redirection; it sends the standard input of the command (./proj33
again) from the file pipe33b
.
的 -
只是一个说法。它通常是由命令视为指示读取,而不是一个文件标准输入。在这种情况下,它很可能是 proj33
通常需要一个文件作为第一个参数,但它会从管道中读取时的说法是 -
。有时, -
用来表示标准输出。在极端情况下,你可以得到一个 -
显示标准输入和一个表示对一个命令的标准输出。随着GNU 焦油
,你可以有焦油-c -f - -T -
的输出被写入到标准输出( -f -
)和文件列表从标准输入存档读取( -T -
)
The -
is just an argument. It is often treated by commands as an indication to read standard input instead of a file. In this context, it is likely that proj33
normally requires a file as its first argument, but it reads from the pipe when the argument is -
. Sometimes, the -
is used to indicate standard output. In extreme cases, you can get one -
indicating standard input and one indicating standard output on a single command. With GNU tar
, you could have tar -c -f - -T -
with the output being written to standard output (-f -
) and the list of files to be archived read from standard input (-T -
).
如果你看到 -
,这是非常不同的;它表示该命令选项结束;任何如下是不是一种选择,即使它有一个破折号启动 -
If you see --
, that is very different; it indicates the 'end of options' for the command; anything that follows is not an option, even if it starts with a dash -
.
这篇关于什么符号 - ,&LT;和大于意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!