问题描述
此处的Ada noob(通常也不太适合命令行使用).我正在寻找与DOS中的>"类似的Ada命令行重定向器.
Ada noob here (and also not so hot with the command line in general). I am looking for the Ada command line redirector that would be analogous to ">" in DOS.
我正在命令行shell中运行Ada应用程序. (威廉·惠特克的话,如果有帮助的话).我使用"@"命令来获取WORDS应用程序,以从文本文件中读取术语列表.
I am running an Ada application in a command line shell. (William Whitaker's WORDS, if that is helpful). I use the "@" command to get the WORDS application to read the list of terms from a text file.
我希望将输出写入文件,而不只是出现在命令外壳中.我确实看过 http://www.ada-auth .org/standards/12rm/html/RM-A-15.html ,但没有看到任何要重定向的内容*.
I want the output to be written to a file, not to just appear in the command shell. I did look at http://www.ada-auth.org/standards/12rm/html/RM-A-15.html but didn't see anything for redirect*.
还可以帮助了解ADA命令行重定向器是否创建新文件,或者我是否必须首先自己做.
Also helpful to know would be whether the ADA command line redirector creates the new file or whether I have to do that myself first.
我需要使用Ada PUT命令吗? Ada.Text_IO?如果是这样,您能指出我如何使用这些命令的语法资源吗?我以前从未用过Ada.
Do I need to use the Ada PUT command? Ada.Text_IO? If so, can you point me to a resource for the grammar of how to use those commands? I've never used Ada before.
有什么想法吗?感谢您的帮助.
Any thoughts? Thanks for your help.
推荐答案
威廉·惠特克的话包含一个交互式命令行解释器,但是您似乎想使用从另一个程序控制它命令行模式.具体细节取决于您选择的环境.作为使用bash
的具体示例,不是从始终写入WORD.OUT
的@<file>
进行读取,而是执行words
,后跟标准输入中的单词列表.结果显示在标准输出上:
William Whitaker's Words includes an interactive command line interpreter, but it looks like you want to control it from another program using command-line mode. The exact details depend your chosen environment. As a concrete example using bash
, instead of reading from @<file>
, which always writes to WORD.OUT
, execute words
followed by a list of words on standard input; the results appear on standard output:
$ ./words amo amas
am.o V 1 1 PRES ACTIVE IND 1 S
amo, amare, amavi, amatus V (1st) [XXXAO]
love, like; fall in love with; be fond of; have a tendency to;
am.as N 1 1 ACC P F
ama, amae N (1st) F [XXXDO] lesser
bucket; water bucket; (esp. fireman's bucket);
am.as V 1 1 PRES ACTIVE IND 2 S
amo, amare, amavi, amatus V (1st) [XXXAO]
love, like; fall in love with; be fond of; have a tendency to;
从标准输出中,您还可以重定向结果到文件;从python
开始,您可以使用commands
或subprocess
;在Java中,对于示例,您可以使用exec()
或ProcessBuilder
:
From standard output, you can also redirect the results to a file; from python
, you might use commands
or subprocess
; in Java you might use exec()
or ProcessBuilder
, for example:
ProcessBuilder pb = new ProcessBuilder("./words", "amo", "amas", "amat");
这篇关于与“"类似的Ada命令行重定向器是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!