【问题标题】:How to catch command line arguments in Berkley Logo (UCBLogo)?如何在 Berkley Logo (UCBLogo) 中捕获命令行参数?
【发布时间】:2014-01-21 03:08:36
【问题描述】:

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。

【问题讨论】:

    标签: logo-lang ucb-logo


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2012-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多