我想知道我是否安装了正确的leptonica版本。我运行tesseract -v输出如下:

tesseract 3.04.01

 leptonica-1.73

  libgif 5.1.2 : libjpeg 8d (libjpeg-turbo 1.4.2) : libpng 1.2.54 : libtiff 4.0.6 : zlib 1.2.8 : libwebp 0.4.4 : libopenjp2 2.1.0

它写在stderr上的输出,所以我的脚本如下所示:
if tesseract -v 2> >(head -n2 | tail -n1) | grep -q 'leptonica-1-73' ; then
    echo "matched"
else
    echo "not found"
fi

当我运行脚本时,它显示:
Syntax error: redirection unexpected.

知道为什么吗?

最佳答案

对。
使用

tesseract -v 2>&1 | head -n2 | tail -n1

而不是
tesseract -v 2> >(head -n2 | tail -n1)

关于linux - 检查终端输出是否与我的字符串匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38853399/

10-11 03:24
查看更多