做一些程序不接受输入的文件,进程替换? [英] Do some programs not accept process substitution for input files?

查看:126
本文介绍了做一些程序不接受输入的文件,进程替换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用进程替换为输入文件到一个程序,它不工作。是不是因为某些程序不允许进程替换为输入文件?

I'm trying to use process substitution for an input file to a program, and it isn't working. Is it because some programs don't allow process substitution for input files?

以下不工作:

bash -c "cat meaningless_name"
    >sequence1
    gattacagattacagattacagattacagattacagattacagattacagattaca
    >sequence2
    gattacagattacagattacagattacagattacagattacagattacagattaca
bash -c "clustalw -align -infile=<(cat meaningless_name) -outfile=output_alignment.aln -newtree=output_tree.dnd"
    (Less verbose output, finishing with:
    No sequences in file. No alignment!

但下面的控制做的工作:

But the following controls do work:

bash -c "clustalw -align -infile=meaningless_name -outfile=output_alignment.aln -newtree=output_tree.dnd"
    (Verbose output, finishing with:
    CLUSTAL-Alignment file created  [output_alignment.aln]
bash -c "cat <(cat meaningless_name) > meaningless_name2"
diff meaningless_name meaningless_name2
    (No output: the two files are the same)
bash -c "clustalw -align -infile=meaningless_name2 -outfile=output_alignment.aln -newtree=output_tree.dnd"
    (Verbose output, finishing with:
    CLUSTAL-Alignment file created  [output_alignment.aln]

这表明,替代过程本身的工作原理,但该CLUSTALW程序本身不喜欢进程替换 - 也许是因为它创建了一个非标准的文件,或者用一个不寻常的文件名创建文件

Which suggest that process substitution itself works, but that the clustalw program itself doesn't like process substitution - perhaps because it creates a non-standard file, or creates files with an unusual filename.

它是常见的方案,不接受进程替换?我将如何检查是否是这种问题?

Is it common for programs to not accept process substitution? How would I check whether this is the issue?

我在Ubuntu 9.10运行GNU bash的版本4.0.33(1) - 释放下(x86_64-PC-Linux的GNU)。 CLUSTALW是2.0.10版本。

I'm running GNU bash version 4.0.33(1)-release (x86_64-pc-linux-gnu) on Ubuntu 9.10. Clustalw is version 2.0.10.

推荐答案

是的。我发现同样的事情在其他程序中。例如,它不能在emacs的工作,要么。它给文件存在,但不能被读取。它绝对是一个特殊的文件,对我来说的/ proc /自/ FD / some_number 。而且它不工作的可靠的任一也不,使用默认设置。

Yes. I've noticed the same thing in other programs. For instance, it doesn't work in emacs either. It gives "File exists but can not be read". And it's definitely a special file, for me /proc/self/fd/some_number. And it doesn't work reliably in either less nor most, with default settings.

对于大多数的:

most <(/bin/echo 'abcdef')

和较短的无显示。长值截断的开始。 显然作品,但只有当你指定 -f

and shorter displays nothing. Longer values truncate the beginning. less apparently works, but only if you specify -f.

我觉得zsh中的 = 有用得多练习。这是语法上是相同的,除了 = ,而不是&LT; 。但它只是创建一个临时文件,因此支持不依赖于该计划。

I find zsh's = much more useful in practice. It's syntactically the same, except = instead of <. But it just creates a temporary file, so support doesn't depend on the program.

编辑:

我发现zsh中使用 TMP preFIX 选择临时文件名。所以,即使你不想让你的真正的 / tmp目录是的 的tmpfs ,你可以安装一个zsh的。

I found zsh uses TMPPREFIX to choose the temporary filename. So even if you don't want your real /tmp to be tmpfs, you can mount one for zsh.

这篇关于做一些程序不接受输入的文件,进程替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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