美文网首页
2018-08-08

2018-08-08

作者: 滚石_c2a6 | 来源:发表于2018-08-08 21:19 被阅读9次

Process substitution on Linux
进程替换命令格式:

(command)
<(command)
即将命令的输出(或输入)视为文件。

bash$ echo >(true)
/dev/fd/63 ,产生/dev/fd/63这样的文件名称

必须用bash,如果用/bin/sh s.sh ,而 s.sh 里面用了进程替换就会报错syntax error near unexpected token `<'

The syntax you've used is a bash extension to the basic shell syntax, so you must take care to run your script with bash. (Ksh also has >(…) process substitution but doesn't support it after a redirection. Zsh would be fine.)

Given the error message you're getting, you are running this script in bash, but in its POSIX compatibility mode, not in full bash mode. Take care to invoke your script with an explicit #!/bin/bash line. #!/bin/sh won't do, even if /bin/sh is a symbolic link to bash, because bash runs in POSIX mode if it's invoked under the name sh. Always invoke bash by name if you use bash features.
参考:https://stackoverflow.com/questions/12120598/syntax-error-in-shell-script-with-process-substitution
https://stackoverflow.com/questions/31371672/how-to-use-process-substitution-in-a-script-run-with-sh-instead-of-bash

参考:http://www.tldp.org/LDP/abs/html/process-sub.html
http://mywiki.wooledge.org/BashFAQ/024
https://www.redpill-linpro.com/sysadvent/2015/12/12/bash-process-substitution.html

set +m
shopt -s lastpipe

相关文章

  • 【随笔】2018-08-08据说,今天适合分手

    今日,2018-08-08; 据说,今天适合分手; 可是, 还没有恋爱; 怎么分手?

  • 感恩日记

    感恩日记 双小宝 2018-08-08 00:03 · 字数 870 · 阅读 0 · 日记本 2018.8.7 ...

  • 夏天

    竹山不爱吃山竹 2018-08-08 19:57 · 字数 2112 · 阅读 0 · 日记本 每年的夏天爸...

  • Android自动化测试

    记录 2018-08-08 该东西只是记录,方便你我他 UiDevice 此类介绍: 打开某个APP 工具介绍 u...

  • PRESS.one,你会用了吗

    [PRESSone拓荒者] 2018-08-08 以下为原作者正文。 PRESS.one的大名很多人都知道,...

  • 手把手教你使用PRESS.one

    [PRESSone拓荒者] 2018-08-08 编者按:不到半年时间,Press.one已经两次重大升级,...

  • 艺像标画画

    周三晚上6:45 周日晚上5:30 2018-08-08晚上6:45。画了一个小雨伞。 西瓜,树叶。

  • 《致良知——责善》

    时间:2018-08-08 君子理应规劝别人向善,这就是“责善”。责善的重点在于“忠告而善道之”,尽心劝诫...

  • 2018-08-08

    2018-08-08 事件:今天听群里分享,觉察自己有份自责。 感受:内疚,自责。 想法:我应该勇敢的去做,去担当...

  • sftp远程与本地文件传输

    writed at 2018-08-08 1.名词解释 ①SSH:是一个安全外壳协议, SSH理解:传统的网络服务...

网友评论

      本文标题:2018-08-08

      本文链接:https://www.haomeiwen.com/subject/utffbftx.html