I decided to try creating some command files to simplify administration:
https://docs.basex.org/wiki/Commands#String_Syntax
I was surprised that this did not work:
% cat foo.bsx
CREATE DB test
ADD TO embedded.xml <root>embedded</root>
# run query
XQUERY <hits>{ count(//text()) }</hits>
CLOSE
% basex foo.bsx
Stopped at /.../foo.bsx, 1/9:
[XPST0003] Unexpected end of query: 'DB test...'.
This works fine:
% basex <foo.bsx
BaseX 9.1 [Standalone]
Try 'help' to get more information.
CREATE DB test
Database 'test' created in 196.04 ms.
ADD TO embedded.xml <root>embedded</root>
Resource(s) added in 101.36 ms.
# run query
XQUERY <hits>{ count(//text()) }</hits>
<hits>1</hits>
Query executed in 393.09 ms.
CLOSE
Database 'test' was closed.
What am I missing?
Jonathan