Write output using proc:execute
Friday, 10 April 2020 · 3 messages
TT
Tim Thompson10 Apr 2020 00:01 #
Hello,
Is it possible to redirect output from a system command within the
proc:execute function?
I would like to do something like:proc:execute("echo", ("hello!", "> hello.txt"))but the ">" does not seem to be recognized.
Thanks in advance,
Tim
--
Tim A. Thompson
Discovery Metadata Librarian
Yale University Library
LQ
Liam R. E. Quin10 Apr 2020 00:31 #
Quoted text · Tim Thompson · 3 lines
On Thu, 2020-04-09 at 16:00 -0400, Tim Thompson wrote: > > proc:execute("echo", ("hello!", "> hello.txt"))
You could run, bash -c 'echo hello > hello.txt'
instead, maybe?
This is assuming you are using Linux or the Linux subsystem on Windows, or cygwin, or OS X... so bash is available.
--
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
TT
Tim Thompson10 Apr 2020 01:09 #
Ah, of course. Thank you, Liam! That's what I needed.
All best,
Tim
--
Tim A. Thompson
Discovery Metadata Librarian
Yale University Library
Quoted text · Liam R. E. Quin · 20 lines
On Thu, Apr 9, 2020 at 4:31 PM Liam R. E. Quin <liam at fromoldbooks.org> wrote: > On Thu, 2020-04-09 at 16:00 -0400, Tim Thompson wrote: > > > > proc:execute("echo", ("hello!", "> hello.txt")) > > You could run, bash -c 'echo hello > hello.txt' > instead, maybe? > > > This is assuming you are using Linux or the Linux subsystem on Windows, > or cygwin, or OS X... so bash is available. > > -- > Liam Quin, https://www.delightfulcomputing.com/ > Available for XML/Document/Information Architecture/XSLT/ > XSL/XQuery/Web/Text Processing/A11Y training, work & consulting. > Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org > >
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery