【问题标题】:diff between local and Hadoop file本地文件和 Hadoop 文件之间的差异
【发布时间】:2014-04-01 19:18:43
【问题描述】:

我正在尝试以下方法:

#!/bin/sh
while read LINE
do
diff source_$LINE <(hadoop fs -cat /user/hadoop-path/$LINE/output) > diff_$LINE
done < FILE

从 cmd Line 可以正常工作,但从 shell 会出现错误: 意外标记 `(' 附近的语法错误

有什么帮助吗?

【问题讨论】:

  • 尝试将 shebang 行更改为 !#/bin/bash!#/bin/ksh。祝你好运。

标签: linux shell hadoop diff bin


【解决方案1】:

进程替换在 POSIX shell (#!/bin/sh) 中不可用。您的交互式 shell 显然是 bash,而您的脚本不是。将 shebang 更改为 #!/bin/bash,或在脚本中使用此处的文档:

diff source_$LINE - <<EOF > diff_$LINE
$(hadoop fs -cat /usr/hadoop-path/$LINE/output)
EOF

【讨论】:

  • 谢谢大家。它有助于。 :)
猜你喜欢
  • 2012-12-11
  • 2014-01-23
  • 1970-01-01
  • 2017-12-31
  • 2011-05-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多