linux中“<”和“<<”有什么区别
发布时间:09/01 来源:未知 浏览:
关键词:
不同:
linux中>表示覆盖原文件内容(文件的日期也会主动更新),>>表示追加内容(会另起一行,文件的日期也会主动更新)。
(引荐教程:linux教程)
举例:
1、将history命令施行的结果留存到history.log文件中
[root@gxzs-solr1 ~]# history > history.log (history.log 文件 会主动生成) [root@gxzs-solr1 ~]# cat history.log
2、施行命令 curl 'xxx' ,将其返回结果留存到 log.log 中
[root@gx-solr1 ~]# curl 'http://192.168.0.110:8983/solr/scan_detail/admin/file?_=1544066402749&contentType=text/plain;charset=utf-8&file=managed-schema&wt=json' > log.log
3、施行命令 cat /etc/hosts , 将其返回结果留存到 hosts.log 中
[root@slave1 ~]# cat /etc/hosts > hosts.log [root@slave1 ~]# more hosts.log 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
留意:使用 > ,施行命令时,每次都会新生成一个 > 后面的文件,将此前生成的文件更换掉(文件创立时间也会跟着改动)。
以上就是linux中“<”和“<<”有什么不同的具体内容,更多请关注百分百源码网其它相关文章!