proc:system and bash redirecting
Wednesday, 17 January 2018 · 2 messages · last reply 18 Jan 2018
KK
Kristian Kankainen17 Jan 2018 19:50 #
Hello!
I need to redirect the content of a file into a program using stdin. In my shell I would do like this (silly example):
wc < somefile
Is this possible to do with
proc:system? Giving "<" as an argument to the command doesn't work:
proc:system("wc", ("<", "somefile")) outputs [BXPR0001] wc: <: No such file or directory
Is there any way around this? The program I need to call can only read from stdin.
Best regards,
Kristian KCG
Christian Grün18 Jan 2018 12:42 #
Hi Kristian,
You may be glad to hear that we recently had a similar requirement. I have revised and extended the Process Module and uploaded a new snapshot [1,2].
Looking forward to your feedback,
Christian
[1] http://docs.basex.org/wiki/Process_Module#proc:system
[2] http://files.basex.org/releases/latest/
Quoted text · Kristian Kankainen · 21 lines
On Wed, Jan 17, 2018 at 7:50 PM, Kristian Kankainen <kristian at keeleleek.ee> wrote: > Hello! > > I need to redirect the content of a file into a program using stdin. In my > shell I would do like this (silly example): > > wc < somefile > > Is this possible to do with proc:system? Giving "<" as an argument to the > command doesn't work: > > proc:system("wc", ("<", "somefile")) outputs [BXPR0001] wc: <: No such file > or directory > > Is there any way around this? The program I need to call can only read from > stdin. > > Best regards, > Kristian K >
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery