相关疑难解决方法(0)

如何通过shell脚本执行mongo命令?

我想在shell脚本中执行mongo命令.

我尝试了以下方式test.sh

#!/bin/sh
mongo myDbName
db.mycollection.findOne()
show collections
Run Code Online (Sandbox Code Playgroud)

当我执行上面的脚本./test.sh

然后建立了mongo连接,但未执行下一个命令

如何通过sh脚本[test.sh]执行其他命令?

请帮我

bash shell sh mongodb

375
推荐指数
15
解决办法
32万
查看次数

标签 统计

bash ×1

mongodb ×1

sh ×1

shell ×1