0

我的脚本包含以下代码:

bin_dir="/export/neo4j-community-2.0.0-M06/bin"
...snip...
  `$bin_dir/neo4j stop`
  stoprc=$?
  if [ "${stoprc}" -ne "0" ] ; then
    echo "Error stopping neo4j.  Please check that it is running."
    exit ${stoprc}
  fi

结果是

Stopping: not found [No such file or directory]
Return code is 127

这是此脚本的 ksh -x 的输出。

+ /export/neo4j-community-2.0.0-M06/bin/neo4j stop
+ Stopping Neo4j Server '[13634]....' done
restore_graph.ksh[42]: Stopping: not found [No such file or directory]
+ stoprc=127

但是当我从命令行运行 ="/export/neo4j-community-2.0.0-M06/bin/neo4j stop" 时,我没有任何问题:

: /export/neo4j-community-2.0.0-M06/bin/neo4j stop
Stopping Neo4j Server [12975].... done
: echo $?
0
4

1 回答 1

1

这条线是问题

`$bin_dir/neo4j stop`

neo4j 停止,但由于反引号,您将输出作为neo4j stop命令执行。

删除那些反引号。

于 2013-10-30T09:20:29.643 回答