Cypher script execution error

getting error while trying to run below cyper script
neo4j> cypher-shell -file /var/lib/neo4j/import/testscript.cql;

Invalid input '-': expected (line 2, column 1 (offset: 7))
"-shell -file /var/lib/neo4j/import/testscript.cql;"

Where should we place the cypher scripts(.cql) to execute them? and what is wrong with the above command?

Appreciate your help!.

Thanks,

it looks like you started cypher-shell, and thus the prompt of

neo4j>

but then at this prompt you entered

cypher-shell -file /var/lib/neo4j/import/testscript.cql;

After starting cypher-shell and getting to the neo4j> prompt the only thing you can do is enter cypher statements. If you want to call cypher-shell and process the contents of a file, and the contents of said file contain a number of cypher statements then this would be accomplished by running

cat <filename with cypher statements> | <command to start cypher-shell>

and thus for your example

cat /var/lib/neo4j/import/testscript.cql | cypher-shell

cypher%20error

what happens when you run

cat /var/lib/neo4j/import/testscript.cql | cypher-shell

Thank you Dana.
Tried your recommendation but still getting an error. Please see attached screenshot.

Thanks,

do not run the cat /var/lib/neo4j/import/testscript.cql | cypher-shell when logged into cypher-shell

from the linux prompt, simply run

cat /var/lib/neo4j/import/testscript.cql | cypher-shell

Thank you.
Here is the output.

ubuntu@ubuntu:/var/lib/neo4j$ cat /var/lib/neo4j/import/testscript.cql | cypher-shell
The client is unauthorized due to authentication failure.

Thanks,

script ran as below
ubuntu@ubuntu:/var/lib/neo4j$ cat /var/lib/neo4j/import/testscript.cql | cypher-shell -u xxxxx -p xxxxx

Thank you for your help.

great to know it works
also for reference if you define environment variable NEO4J_USER and NEO4J_PASSWORD, for example

export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password

and replacing neo4j and password above with the respective values for your implementation then they will be used for -u and -p when running cypher-shell. Thus if you run

export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password
cat /var/lib/neo4j/import/testscript.cql | cypher-shell 

then it will run the contents of /var/lib/neo4j/import/testscript.cql through a cypher-shell connection and authenticate with the values specified by NEO4J_USER and NEO4J_PASSWORD