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中的栈内存空间和堆内存空间有 ...
随机推荐
- jQuery记忆巩固
jQuery是由原生js写的所以说所有jQuery制作出来的效果都可以使用js做出来,jQuery出现的目的是为了优化代码,提高码代码的效率它将很多功能封装. 一.jQuery的认识 1.何为jque ...
- 某谷 P5159 WD与矩阵
题面在这里 崴脚回家后的小休闲2333. 显然每一行的1的个数必须是偶数,这样可以归纳证明前i行异或出来的m位二进制数也有偶数个1,这样最后一行就有且仅有一种放法了. 于是ans = 2^((n-1) ...
- 为什么Android手机总是越用越慢?
根据第三方的调研数据显示,有77%的Android手机用户承认自己曾遭遇过手机变慢的影响,百度搜索“Android+卡慢”,也有超过460万条结果.在业内,Android手机一直有着“越用越慢”的口碑 ...
- bzoj 2011
决策单调性,对于一个1D/1D(状态是一维,转移也是一维)的DP,如果DP的决策具有单调性,那么就可以做到O(nlogn)的复杂度完成DP. 感谢<1D/1D 动态规划优化初步>的作者. ...
- [OpenGL]纹理贴图实现 总结
实现步骤 第一步:设置所需要的OpenGL环境 设置上下文环境 删除已经存在的渲染的缓存 设置颜色缓存 设置帧缓存 清除缓存 设置窗口大小 开启功能 编译shander 使用program 获取sha ...
- 解决mysql控制台查询数据乱码的问题,有图有真相
在mysql 控制台当 当为gbk的时候查询的数据是汉字,假设不是则为乱码. set names gbk; 那么查询出来的数据则为汉字
- 74HC125 74HCT125 74LV125 74LVC125
74HC125; 74HCT125Quad buffer/line driver; 3-state The 74HC125; 74HCT125 is a quad buffer/line driver ...
- druid数据源
Druid是一个JDBC组件,它包括三部分: DruidDriver 代理Driver,能够提供基于Filter-Chain模式的插件体系. DruidDataSource 高效可管理的数据库连接池 ...
- 完整的POM文档内容
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- Windows+VS2012环境下编译调试MySQL源码 转
http://m.blog.csdn.net/blog/SnowyWolf/18952643