在使用bash重定向时,我怎么能看到未来?
发布时间:2020-12-15 21:30:25 所属栏目:安全 来源:网络整理
导读:我在书中遇到以下代码,仍然不明白为什么.有人可以帮忙解释一下吗? [root@wd00070319 test]# ls[root@wd00070319 test]# touch file1[root@wd00070319 test]# lsfile1[root@wd00070319 test]# ls file2[root@wd00070319 test]# lsfile1 file2[root@wd0007031
我在书中遇到以下代码,仍然不明白为什么.有人可以帮忙解释一下吗?
[root@wd00070319 test]# ls [root@wd00070319 test]# touch file1 [root@wd00070319 test]# ls file1 [root@wd00070319 test]# ls > file2 [root@wd00070319 test]# ls file1 file2 [root@wd00070319 test]# cat file2 file1 file2 [root@wd00070319 test]# 解决方法[root@wd00070319 test]# ls # list the files. (directory is empty!) [root@wd00070319 test]# touch file1 # create an empty file called "file1" [root@wd00070319 test]# ls # list the files again (to see "file1") file1 [root@wd00070319 test]# ls > file2 # list the files,put the result in "file2" [root@wd00070319 test]# ls # list the files again,file1 file2 [root@wd00070319 test]# cat file2 # show content of file2 file1 file2 # <-- Note that "file2" is present as well. [root@wd00070319 test]# 这里的教训可能是像ls>这样的命令. file2在实际执行ls命令之前创建输出文件(file2). bash参考手册确认了此行为:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- ng2-dragula [dragula](angular2拖放) – * ngFor与[dragul
- angular – Typescript中的解构赋值
- 当模型更新时,我可以防止/延迟AngularJS $摘要的发生
- 具有使用AngularJS并连接到ASP.NET Web API 2的登录屏幕的S
- Angular 2:如何使用Observable过滤器
- AngularJS应用程序使用HTML5模式在锚定标签中链接/路由
- 如何从console main方法运行SimpleSwingApplication?
- 如何在bash中重置光标颜色
- webservice的调用
- 在Vim中命令cw和ciw之间的区别是什么?