What's the difference between - (one hyphen) and — (two hyphens) in a command?
bash中看到这样的命令,
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs 黄色部分,| 这个是管道操作符,表示前面命令的输出作为后面的命令的输入。 "bash -" bash 跟一个短杠的作用是什么呢?
For a command, if using-as an argument in place of a file name will mean STDIN or STDOUT.
---------------------------------------------------------
Generally:
-means to read the argument/content from STDIN (file descriptor 0)--means end of command options, everything follows that are arguments
Why needed:
About -:
$ echo foobar | cat -
foobar
Although cat can read content from STDIN without needing the -, many commands need that and their man pages mention that explicitly.
Now about --, I have created a file -spam, let's cat the file:
$ echo foobar >-spam
$ cat -spam
cat: invalid option -- 'p'
Try 'cat --help' for more information.
$ cat -- -spam
foobar
Without --, cat takes s, p, a, m all as it's options as they follow -, -- explicitly indicates the end of option(s), after that -spam is taken as a file name.
What's the difference between - (one hyphen) and — (two hyphens) in a command?的更多相关文章
- SQL injection
SQL injection is a code injection technique, used to attack data-driven applications, in which malic ...
- Git - Tutorial [Lars Vogel]
From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...
- Git - Tutorial官方【转】
转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...
- 关于php文件读取的一些学习记录
初学PHP的时候使用了一些文件读取API,但是没有真正弄清楚各API的区别以及差异,于是找了一篇学习了一下,贴在这里,引用自IBM社区的一篇文章, 整体整理测试如下 <?php /** * Cr ...
- 向Docx4j生成的word文档中添加布局--第二部分
原文标题:Adding layout to your Docx4j-generated word documents, part 2 原文链接:http://blog.iprofs.nl/2012/1 ...
- MySQL之mysql命令使用详解
MySQL Name mysql - the MySQL command-line tool Synopsis mysql [options] db_name Description mysql is ...
- 批量删除linux的文件;find方法批量删除文件;find查找某时间段内的所有文件
1.如图所示,有大量文件夹,想批量删除它们 2.使用命令 find . -maxdepth 1 -regex ".*ws.*" 可以批量找到他们.maxdepth值为1表示只在当 ...
- su with hyphen and without - su带横杠和不带横杠
The difference between "-" and "no hyphen" is that the latter keeps your existin ...
- Java 堆内存与栈内存异同(Java Heap Memory vs Stack Memory Difference)
--reference Java Heap Memory vs Stack Memory Difference 在数据结构中,堆和栈可以说是两种最基础的数据结构,而Java中的栈内存空间和堆内存空间有 ...
随机推荐
- [ 原创 ] Java基础1--Java中super和this的用法和区别
许多同学在学习Java时分不清楚this和super的用法和区别,今天偶然发现一片加精的博文,看完内容准备自己也写下来积累一下 1.如果想在子类的构造方法中调用父类的构造方法,必须在子类的构造方法中使 ...
- http常见请求头与响应头
1.HTTP常见的请求头 If-Modified-Since:把浏览器端缓存页面的最后修改时间发送到服务器去,服务器会把这个时间与服务器上实际文件的最后修改时间进行对比.如果时间一致,那么返回304, ...
- 【WIN10】文本圖標
在Storyboard動畫板中,我使用文本顯示了一個“心”形.在這裡,我將介紹一下文本圖標. 1.Segoe MDL2 Assets 首先,它必須使用字體:Segoe MDL2 Assets 其次,它 ...
- Centos7下shell脚本添加开机自启动
添加开机自启脚本,注意都需要用绝对路径 psubscribe.sh脚本中的内容: nohup /usr/bin/php -f /data/aliyun51015cn/redisChannel/psub ...
- [BZOJ3309]DZY Loves Math(莫比乌斯反演+线性筛)
$\sum\limits_{T=1}^{n}\lfloor\frac{n}{T}\rfloor\lfloor\frac{m}{T}\rfloor\sum\limits_{d|T}f(d)\mu(\fr ...
- MySQL主从复制(Replication)(MySQL数据同步)配置
MySQL是开源的关系型数据库系统.复制(Replication)是从一台MySQL数据库服务器(主服务器master)复制数据到另一个服务器(从服务器slave)的一个进程. 配置主服务器(mast ...
- Codeforces Round #360 (Div. 1) D. Dividing Kingdom II 暴力并查集
D. Dividing Kingdom II 题目连接: http://www.codeforces.com/contest/687/problem/D Description Long time a ...
- C#高级编程9-第4章 继承
继承是面向对象的一大特征.要深刻学习继承,需要学会使用调试的技巧来学习它,因为它比较抽象. 继承 继承是指一个具体的类型直接使用另一类型的某些数据成员或函数成员,继承的类是基类(父类),被继承的类是派 ...
- mysql的性能监控指标(转载)
这里列出了一些如何监视你安装的mysql性能的一些ideas.监视总是一个持续的过程.你需要知道哪种模式对你的数据库是好的,什么是问题的表象,甚至是危险的情况.一下列出了用来去监视你的系统的主要参数: ...
- java的(PO,VO,TO,BO,DAO,POJO)解释1
java的(PO,VO,TO,BO,DAO,POJO)解释 O/R Mapping 是 Object Relational Mapping(对象关系映射)的缩写.通俗点讲,就是将对象与关系数据库绑定 ...