gpt4 book ai didi

shebang - Unix shebang 与 Gforth

转载 作者:行者123 更新时间:2023-12-01 09:59:12 30 4
gpt4 key购买 nike

我无法获取 Gforth当我有 shebang 时运行在脚本的顶部,例如:

#!/usr/bin/gforth
: pinoke ." I'm a real boy!!! "
pinoke

Unix 似乎可以很好地启动 gForth,但 gForth 本身在 shebang 行上阻塞。我不确定如何定义一个词以导致 Forth 以不同方式解释 shebang 行(并不是说它不能完成,但我只是不确定它会怎样)。

我考虑过使用脚本将代码文件提供给 gForth,但是一遍又一遍地这样做可能会很尴尬。有没有办法让 gForth 像其他语言一样接受 shebang?

最佳答案

#!/usr/bin/gforth 之间需要一个空格。

参见 13.7 Running Image Files (在 Gforth 手册中):

The sequence #! is used in two ways; firstly, it is recognised as a “magic sequence” by the operating system1 secondly it is treated as a comment character by Gforth. Because of the second usage, a space is required between #! and the path to the executable

关于shebang - Unix shebang 与 Gforth,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18899111/

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