gpt4 book ai didi

logo-lang - 如何在 Berkley Logo (UCBLogo) 中捕获命令行参数?

转载 作者:行者123 更新时间:2023-12-02 01:54:44 29 4
gpt4 key购买 nike

Berkeley Logo User Manual 告诉我们,所有在连字符后的命令行参数都将收集在变量中:

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。

最佳答案

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

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

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

关于logo-lang - 如何在 Berkley Logo (UCBLogo) 中捕获命令行参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20903786/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com