Hello everybody,
thanks for your help.
using single quotes like Andreas suggested solved the issue.
 
I also tried another solution by including the query into a file
$ java -cp BaseX.jar org.basex.BaseX  < test.txt
 
conten of test.txt
open dbname
xquery <results>{ let $total:=count(//callRecords/*) return <total>{$total}</total>}</results>
 
Thanks again for your support.
Hector

 
On Tue, Apr 19, 2011 at 9:28 PM, Andreas Weiler <andreas.weiler@uni-konstanz.de> wrote:
Right,
this one works for me (Mac Terminal): java -cp BaseX.jmin -Padmin -c'xquery let $i := 10 return $i'

-- Andreas
>
> Am 19.04.2011 um 21:24 schrieb Imsieke, Gerrit, le-tex:
>
>> Might have sth to do with shell interpolation? If you use single quotes around the -c option's argument, the shell won't try to expand $i to (presumably) the empty string.
>>
>> Jan's example might have worked because he used another type of shell.
>>
>> Gerrit
>>
>> On 2011-04-19 21:14, Andreas Weiler wrote:
>>> Hi Hector, Hi Jan,
>>>
>>> i can reproduce the error with BaseX 6.6.1...strange.
>>>
>>> java -cp BaseX.jar org.basex.BaseXClient -Uadmin -Padmin -c"xquery let
>>> $i := 10 return $i"
>>> Error: Stopped at line 1, column 12:
>>> Syntax: XQUERY [query]
>>> Evaluate XQuery.
>>>
>>> We will have a look at it.
>>>
>>> -- Andreas
>>>
>>> Am 19.04.2011 um 20:27 schrieb Jan Vlèinský (CAD):
>>>
>>>> Hi Hector
>>>> I run query like you, only using my existing database name and
>>>> counting my elements, which exists there and I had no problem. I
>>>> suspected that before : shall be a space, but this is not the case, it
>>>> makes no difference in my test:
>>>>
>>>> D:\opt\BaseX>java -cp BaseX.jar org.basex.BaseXClient -Uadmin -Padmin
>>>> -c"open ISO;xquery <results>{ let $total:=count(//LOCT) return
>>>> <total>{$total}</total>}</results>"
>>>> <results>
>>>> <total>1487</total>
>>>> </results>
>>>>
>>>> I use BaseX version 6.6.1
>>>>
>>>>  1. What version of BaseX do you use?
>>>>  2. Are you sure you run the same version for server and for the
>>>>     client? Once I had troubles mixing different versions.
>>>>
>>>>
>>>> With best regards
>>>>
>>>> Jan
>>>> 2011/4/19 Hector Diaz <hectordanieldg@gmail.com
>>>> <mailto:hectordanieldg@gmail.com>>
>>>>
>>>>   Hello,
>>>>   I am trying to run some Xqueries from command line but I am
>>>>   getting the following error:
>>>>   $ java -cp "C:\Program Files\BaseX\BaseX.jar"
>>>>   org.basex.BaseXClient -Uadmin -Pa
>>>>   dmin -c"open dbname;xquery <results>{ let
>>>>   $total:=count(//callRecords/*) return <t
>>>>   otal>{$total}</total>}</results>"
>>>>   Error: Stopped at line 1, column 30:
>>>>   [XPST0003] Expecting "}", found ":".
>>>>   If I run the query from the GUI it runs correctly, but here I am
>>>>   always getting this error.
>>>>   I tried running other dummy queries that work in the GUI but here
>>>>   I get an error like this:
>>>>   $ java -cp "C:\Program Files\BaseX\BaseX.jar"
>>>>   org.basex.BaseXClient -Uadmin -Pa
>>>>   dmin -c"open dbname;xquery let $total := count(//callRecords/*)
>>>>   return $total"
>>>>   Error: Stopped at line 1, column 23:
>>>>   Syntax: XQUERY [query]
>>>>   Evaluate XQuery.
>>>>   Any idea of how to solve this?
>>>>   Is it possible to use let in queries from command?
>>>>   Thanks in advance for your help.
>>>>   Hector
>>>>
>>>>   _______________________________________________
>>>>   BaseX-Talk mailing list
>>>>   BaseX-Talk@mailman.uni-konstanz.de
>>>>   <mailto:BaseX-Talk@mailman.uni-konstanz.de>
>>>>   https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Ing. Jan Vlèinský*
>>>> CAD programy
>>>> Sluneènicová 338/3, 734 01 Karviná Ráj, Czech Republic
>>>> tel: +420-597 602 024; mob: +420-608 979 040
>>>> skype: janvlcinsky; GoogleTalk: jan.vlcinsky@gmail.com
>>>> <mailto:jan.vlcinsky@gmail.com>
>>>> http://cz.linkedin.com/in/vlcinsky
>>>>
>>>> _______________________________________________
>>>> BaseX-Talk mailing list
>>>> BaseX-Talk@mailman.uni-konstanz.de
>>>> <mailto:BaseX-Talk@mailman.uni-konstanz.de>
>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>>>
>>>
>>>
>>> _______________________________________________
>>> BaseX-Talk mailing list
>>> BaseX-Talk@mailman.uni-konstanz.de
>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>>
>> --
>> Gerrit Imsieke
>> Geschäftsführer / Managing Director
>> le-tex publishing services GmbH
>> Weissenfelser Str. 84, 04229 Leipzig, Germany
>> Phone +49 341 355356 110, Fax +49 341 355356 510
>> gerrit.imsieke@le-tex.de, http://www.le-tex.de
>>
>> Registergericht / Commercial Register: Amtsgericht Leipzig
>> Registernummer / Registration Number: HRB 24930
>>
>> Geschäftsführer: Gerrit Imsieke, Svea Jelonek,
>> Thomas Schmidt, Dr. Reinhard Vöckler
>

_______________________________________________