【发布时间】:2020-03-10 02:43:07
【问题描述】:
我目前正在尝试使用 shell 读取文件。但是,我遇到了一个语法问题。我的代码如下:
while read -r line;do
echo $line
done < <(tail -n +2 /pathToTheFile | cut -f5,6,7,8 | sort | uniq )
但是,它返回错误syntax error near unexpected token('`
我尝试关注How to use while read line with tail -n,但仍然看不到错误。
tail 命令正常工作。
如有任何帮助,将不胜感激。
【问题讨论】:
-
posix shell
/bin/sh不支持进程替换。它是 bash (和其他)特有的功能。你在/bin/bash运行这个吗?
标签: bash shell sh process-substitution