Hi All,
I have been able to run the command just putting it in a bash file and then running this file with proc:execute. It works. The problem now is with the encoding of the text returned by proc:execute. In my bash I can display Greek characters, but they are messed up if returned by the proc:execute function. I also added utf-8 as a parameter for the function but nothing changes. How can I solve this? Thanks.
Joseph
Il giorno 09/nov/2015, alle ore 10:41, Jens Erat jens.erat@uni-konstanz.de ha scritto:
Hi Joseph,
As far as I understand the documentation, BaseX `proc:system` does not use a shell interpreter by default. `<` or also the pipe `|` are features offered by your shell, not the operating system.
Instead of passing a single parameter, pass the command as parameter to `/usr/bin/env sh -c`, which will make BaseX run a shell that interpretes I/O indirection:
proc:system('/usr/bin/env', ('sh', '-c', 'opennlp postagger model.bin < file.txt'))
This might be a reasonable thing to provide as a built-in function, I'm also not sure whether one can connect some kind of stream/strings to STDIN, STDOUT and STDERR.
Regards from Lake Constance, Germany, Jens
Am 09.11.2015 um 10:19 schrieb Christian Grün:
Any suggestions?
Any example? ;) Christian
Thanks.
Joseph
Inizio messaggio inoltrato:
Da: meumapple meumapple@gmail.com Data: 06 novembre 2015 20:52:08 CET A: BaseX basex-talk@mailman.uni-konstanz.de Oggetto: Bash command
Hi all,
I am using proc:system for a bash command but I cannot run it. It looks like opennlp postagger model.bin < file.txt. I suspect that the problem is the less-than sign, which is converted into < Is there any way to keep the less-than sign and pass it to the bash properly? Thanks.
Joseph