什么是的&QUOT神奇; - " (破折号)在命令行参数? [英] What's the magic of "-" (a dash) in command-line parameters?

查看:184
本文介绍了什么是的&QUOT神奇; - " (破折号)在命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:


  • 创建ISO映像,并直接将其刻录到CD上。

  • Create an ISO image and burn it directly to a CD.

的mkisofs -V照片-R /家庭/维韦克/照片| cdrecord的-v开发=的/ dev / DVDRW -

更改为previous目录。

Change to the previous directory.

CD -

监听端口12345和发送​​给它解压缩数据。

Listen on port 12345 and untar data sent to it.

NC -l -p 12345 |焦油xvzf -

什么是破折号的目的,我怎么使用它?

What is the purpose of the dash and how do I use it?

推荐答案

如果你指的是裸露的 - 在年底焦油命令,这是常见的上想用一个文件的许多命令。

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的命令采取标准输入(所产生的ISO映像流的mkisofs ),并直接写入它的/ 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.

这篇关于什么是的&QUOT神奇; - " (破折号)在命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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