3

Berkeley Logo 用户手册告诉我们,hypen 之后的所有命令行参数都将收集在变量中:

If a command line argument is just a hyphen, then all command line arguments
after the hyphen are not taken as filenames, but are instead collected in a
list, one word per argument; the buried variable COMMAND.LINE contains that
list of arguments, or the empty list if there are none.  On my Linux system,
if the first line of an executable shell script is
#!/usr/local/bin/logo -
(note the hyphen) then the script can be given command line arguments and
they all end up in :COMMAND.LINE along with the script's path.  Experiment.

我试了一下,还是不行:

$ cat test.lg
#!/usr/bin/logo - 
print :COMMAND.LINE

$ ./test.lg 
I can't open file -
? 

有什么想法有什么问题吗?

我使用 Ubuntu 软件包中的 ucblogo 5.5-2.1。

4

1 回答 1

2

Berkeley Logo 5.5 不支持从脚本解析命令行参数。

您引用的用户手册适用于 Berkeley Logo 版本 6。您应该能够像使用 ucblogo-6.0 一样使用命令行参数。

您可以从http://www.eecs.berkeley.edu/~bh/下载 Berkeley Logo 6.0

于 2014-08-13T07:21:19.710 回答