小编Rob*_*att的帖子

通过 -c 传递给 bash 时脚本不起作用

为什么这样做:

$ cat test.sh
#!/bin/bash
cat <(date|awk '{print $1}')

$ ./test.sh
Thu
Run Code Online (Sandbox Code Playgroud)

但不是作为传递给 bash 的命令:

$ bash -c "cat <(date|awk '{print $1}')"
Thu  2 Apr 2020 12:52:10 BST
Run Code Online (Sandbox Code Playgroud)

我在 macOS 上运行这个

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
Run Code Online (Sandbox Code Playgroud)

bash quoting process-substitution

6
推荐指数
1
解决办法
590
查看次数

标签 统计

bash ×1

process-substitution ×1

quoting ×1