linux管道关闭了数据还在吗,关于awk中通过管道执行shell后的管道关闭问题

close(file [, how])   Close file, pipe or co-process.  The optional how should only be used when closing one end of a two-way pipe  to

a co-process.  It must be a string value, either "to" or "from".

system(cmd-line)      Execute the command cmd-line, and return the exit status.  (This may not be available on non-POSIX systems.)

fflush([file])        Flush any buffers associated with the open output file or pipe file.  If file is missing, then  standard  output

is flushed.  If file is the null string, then all open output files and pipes have their buffers flushed.

Additional output redirections are allowed for print and printf.

print ... >> file

Appends output to the file.

print ... | command

Writes on a pipe.

print ... |& command

Sends data to a co-process or socket.  (See also the subsection Special File Names, below.)

The getline command returns 1 on success, 0 on end of file, and -1 on an error.  Upon an error, ERRNO contains a string describing the

problem.

NOTE: Failure in opening a two-way socket will result in a non-fatal error being returned to the calling function. If  using  a  pipe,

co-process,  or  socket to getline, or from print or printf within a loop, you must use close() to create new instances of the command

or socket.  AWK does not automatically close pipes, sockets, or co-processes when they return EOF.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值