击双进程替换带来坏的文件描述符 [英] Bash double process substitution gives bad file descriptor

查看:229
本文介绍了击双进程替换带来坏的文件描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试引用两个进程替换的管道在bash功能,只有第一个引用的作品。第二个给出了一个坏文件描述符错误,像这样:

When I try to refer to two process substitution pipes in a bash function, only the first one referenced works. The second one gives a "bad file descriptor" error like so:

$ foo(){
> cat "$1"
> cat "$2"
> }
$ foo <(echo hi) <(echo bye)
hi
cat: /dev/fd/62: Bad file descriptor
$ 

看来,当一个被引用的第二个管道被删除,但一)我似乎无法确认任何文件,这种行为和b)我想不会。 =)

It appears that the second pipe is dropped once one is referenced, but a) I cannot seem to confirm this behavior in any documentation and b) I wish it wouldn't. =)

这是我做错了任何想法? FWIW我做这做包装使用Mac OS X的图形FileMerge比较工具而不是命令行之一,这已经是高兴从命令行多个管道工作的。

Any ideas on what I'm doing wrong? FWIW I'm doing this to make a wrapper to use Mac OS X's FileMerge graphical diff tool instead of the command line one, which is already happy to work with multiple pipes from the command line.

-Rob

推荐答案

/斌/庆典与OSX(3.2.48)失败上提供。从MacPorts的一个(4.2.37 - 通常的/ opt / local / bin目录/ bash的如果您有它安装)工作正常。无论是版本还是构建我不知道。也许你可能要使用的MacPorts的bash这个脚本。我们当然有可能对每台Mac的MacPorts,所以我假定你做什么; - )

The /bin/bash supplied with OSX (3.2.48) fails on that. The one from macports (4.2.37 — normally /opt/local/bin/bash if you have it installed) works fine. Whether it is version or build I don't know. Perhaps you may want to use macports bash for this script. One certainly has to have macports on every mac, so I assume you do ;-)

这篇关于击双进程替换带来坏的文件描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆