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中的栈内存空间和堆内存空间有 ...
随机推荐
- scrapy运行机制
Scrapy主要包括了以下组件: 引擎(Scrapy)用来处理整个系统的数据流, 触发事务(框架核心) 调度器(Scheduler)用来接受引擎发过来的请求, 压入队列中, 并在引擎再次请求的时候返回 ...
- django 动态url 可变
首先在urls里面改,name=让一个映射敷个名字. 然后到books——list页面让编辑按钮改成这种可变的映射模式.
- 高并发系列之——负载均衡,web负载均衡
1 前言 负载均衡,一般包含两方面的含义.一方面是,将单一的重负载分担到多个网络节点上做并行处理,每个节点处理结束后将结果汇总返回给用户,这样可以大幅提高网络系统的处理能力: 第二个方面的含义是,将大 ...
- bzoj 1312 最大密度子图
晕,m=0是要输出1(弄的我还找管理员要数据,但明显题意是叫我们输出0呀) 最大密度子图,把边转换成点,然后二分答案,跑最大权闭合子图判定是否可行. #include <cstdio> # ...
- Codeforces Round #257 (Div. 2 ) B. Jzzhu and Sequences
B. Jzzhu and Sequences time limit per test 1 second memory limit per test 256 megabytes input standa ...
- SQL Server Management Studio 教程一:设置sa用户登录
今天在net项目中添加数据库过程中出现了小问题,就是使用sql server身份验证没登录成功,经过一番调试,终于解决问题. 使用sa账户登录sql server 2008 的方法步骤如下: 1.首先 ...
- 机器学习(1):Logistic回归原理及其实现
Logistic回归是机器学习中非常经典的一个方法,主要用于解决二分类问题,它是多分类问题softmax的基础,而softmax在深度学习中的网络后端做为常用的分类器,接下来我们将从原理和实现来阐述该 ...
- 从零开始搭建linux下laravel 5.5所需环境(二)
我们已经装好了nginx,现在我们开始装mysql和php 我们同样使用yum来安装. 先安装MySQL软件(客户端.服务器端.依赖库) yum install -y mysql mysql-serv ...
- mklink让网盘同步不同文件夹
mklink简介 Linux 下有一个叫符号链接的东东,是 ln 这个链接命令,mklink 和 ln 的功能几乎一样.在xp系统下,junction命令要用微软开发的小程序 junction.exe ...
- TransactionScope只要一个操作失败,它会自动回滚,Complete表示事务完成
实事上,一个错误的理解就是Complete()方法是提交事务的,这是错误的,事实上,它的作用的表示本事务完成,它一般放在try{}的结尾处,不用判断前台操作是否成功,如果不成功,它会自己回滚. #re ...