问题描述
示例:
创建 ISO 映像并将其直接刻录到 CD.
Create an ISO image and burn it directly to a CD.
mkisofs -V 照片 -r/home/vivek/photos |cdrecord -v dev=/dev/dvdrw -
切换到上一个目录.
cd -
侦听端口 12345 并解压缩发送给它的数据.
Listen on port 12345 and untar data sent to it.
nc -l -p 12345 |tar xvzf -
破折号的目的是什么,我该如何使用它?
What is the purpose of the dash and how do I use it?
推荐答案
如果您指的是 tar
命令末尾的裸露 -
,这在许多命令中都很常见想要使用文件.
If you mean the naked -
at the end of the tar
command, that's common on many commands that want to use a file.
它允许您指定标准输入或输出而不是实际文件名.
It allows you to specify standard input or output rather than an actual file name.
您的第一个和第三个示例就是这种情况.例如,cdrecord
命令采用标准输入(由 mkisofs
生成的 ISO 映像流)并将其直接写入 /dev/dvdrw
.
That's the case for your first and third example. For example, the cdrecord
command is taking standard input (the ISO image stream produced by mkisofs
) and writing it directly to /dev/dvdrw
.
使用cd
命令,每次更改目录时,它都会存储您来自的目录.如果您使用特殊的 -
目录名称"执行 cd
,它会使用记住的目录而不是真实的目录.使用它,您可以轻松地在两个目录之间快速切换.
With the cd
command, every time you change directory, it stores the directory you came from. If you do cd
with the special -
"directory name", it uses that remembered directory instead of a real one. You can easily switch between two directories quite quickly by using that.
其他命令可能会将 -
视为 不同的 特殊值.
Other commands may treat -
as a different special value.
这篇关于“-"的魔力是什么?(破折号)在命令行参数中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!