Garrett
Garrett

Reputation: 11725

Write into database console after running it through shell script

I'm trying to write a script that will run the OrientDB shell and then connect via the proper command and credentials. However, I can't get any text to go in after running the console.

#!/bin/bash

(cd ../libs/orientdb-community-1.7.4/bin && source console.sh) && echo "CONNECT remote:localhost/pumpup root test"

This is what I get:

gsquare567@Macintosh ~/S/p/s/scripts> ./db_console.sh

OrientDB console v.1.7.4 (build UNKNOWN@r; 2014-06-23 19:29:10+0200) www.orientechnologies.com
Type 'help' to display all the commands supported.
Installing extensions for GREMLIN language v.2.5.0

orientdb>

After manually entering the command, it should do this:

orientdb> CONNECT remote:localhost/pumpup root test

Connecting to database [remote:localhost/pumpup] with user 'root'...OK
orientdb {pumpup}>

How can I get the echoed command to run in the new console?

Upvotes: 0

Views: 519

Answers (2)

Lvca
Lvca

Reputation: 9060

With OrientDB 2.0-SNAPSHOT you can also enable echo:

(cd ../libs/orientdb-community-1.7.4/bin && source console.sh) && echo "set echo true;CONNECT remote:localhost/pumpup root test"

Upvotes: 1

enisher
enisher

Reputation: 309

Echo prints string into standard output but not passes it to a command.

Console supports file name as an argument, so you can write your SQL script into a file and then run:

./console.sh script.sql

Upvotes: 0

Related Questions