首页 > 其他 > 详细

IO重定向

时间:2020-10-19 21:42:40      阅读:33      评论:0      收藏:0      [点我收藏+]
程序:指令+数据

读入数据:input
输出数据:output

打开的文件都有一个fd:file descriptor 文件描述符
Linux给程序提供三种I/O设备

  • 标准输入(STDIN) -0 默认接受来自终端窗口的输入
  • 标准输出(STDOUT)-1 默认输出到终端窗口
  • 标准错误(STDERR)-2 默认输出到终端窗口
[root@centos7 proc]# echo $$
2199
[root@centos7 proc]# ll /proc/$$/fd
总用量 0
lrwx------. 1 root root 64 10月 19 20:09 0 -> /dev/pts/0
lrwx------. 1 root root 64 10月 19 20:09 1 -> /dev/pts/0
lrwx------. 1 root root 64 10月 19 20:09 2 -> /dev/pts/0
lrwx------. 1 root root 64 10月 19 20:22 255 -> /dev/pts/0
[root@centos7 proc]# 
[root@centos7 proc]# ll /proc/self/fd
总用量 0
lrwx------. 1 root root 64 10月 19 20:25 0 -> /dev/pts/0
lrwx------. 1 root root 64 10月 19 20:25 1 -> /dev/pts/0
lrwx------. 1 root root 64 10月 19 20:25 2 -> /dev/pts/0
lr-x------. 1 root root 64 10月 19 20:25 3 -> /proc/2222/fd

IO重定向

原文:https://blog.51cto.com/abyssce/2542531

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!