为什么使用fish时sbt会退出?

发布于 2024-10-08 12:21:20 字数 694 浏览 10 评论 0原文

我正在尝试使用 Fish shell 来运行 sbt。

#!/usr/local/bin/fish 
java -Xmx512M -jar (dirname (status -f))/sbt-launch-0.7.4.jar "$argv"

当我调用 sbt 时,我得到以下信息

[info] Building project MyProject 1.0 against Scala 2.8.1
[info]    using MyProject with sbt 0.7.4 and Scala 2.7.7
[info] 
[info] Total session time: 1 s, completed Dec 19, 2010 4:29:46 PM
[success] Build completed successfully.

然后 sbt 退出。为什么?难道不应该等待命令吗?

在可能相关的注释中,我确信当我使用 bash 时,我不必在第一行执行 #![shell] 。发生了什么变化?

更新: 当编写等效脚本以使用 bash 时一切正常,sbt 不会执行构建然后退出

#!/bin/bash
java -Xmx512M -jar `dirname $0`/sbt-launch-0.7.4.jar "$@"

I'm trying to get sbt running using the fish shell.

#!/usr/local/bin/fish 
java -Xmx512M -jar (dirname (status -f))/sbt-launch-0.7.4.jar "$argv"

When I call sbt I get the following

[info] Building project MyProject 1.0 against Scala 2.8.1
[info]    using MyProject with sbt 0.7.4 and Scala 2.7.7
[info] 
[info] Total session time: 1 s, completed Dec 19, 2010 4:29:46 PM
[success] Build completed successfully.

Then sbt quits. Why? Shouldn't it just wait for commands?

On a possibly related note, I'm sure I didn't used to have to do #![shell] on the first line when I was using bash. What's changed?

UPDATE:
When writing the equivalent script to use bash everything works fine, sbt doesn't do a build then quit

#!/bin/bash
java -Xmx512M -jar `dirname $0`/sbt-launch-0.7.4.jar "$@"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灼痛 2024-10-15 12:21:20

如果您不使用 shebang(示例中的 #!/usr/local/bin/fish),脚本将使用系统上的默认 shell 运行,这可能是 / bin/sh.

如果您使用 #!/bin/sh#!/bin/bash 运行脚本,它是否按照您期望的方式工作?

您的脚本中没有任何内容会影响其与其他 shell 的工作方式不同。我不明白你的脚本与你正在做的事情有何关系(主要是因为我不熟悉 sbt)。你的脚本的名字是什么?怎么称呼?你怎么称呼sbt?

If you don't use a shebang (#!/usr/local/bin/fish in your example), a script will run with the default shell on your system, which is likely /bin/sh.

If you run your script using #!/bin/sh or #!/bin/bash does it work the way you expect it to?

There's nothing in your script that should affect how things work differently from other shells. I don't understand how your script relates to what you're doing (mostly because I'm unfamiliar with sbt). What is the name of your script? How is it called? How are you calling sbt?

网名女生简单气质 2024-10-15 12:21:20

看起来您正在将 shell 作为脚本运行,而不是 shell。 Fish 只会运行您的 java 命令,然后退出。

删除该脚本并使其可执行,我相信您可以将其作为

/path/to/fish /path/to/script

运行。

Looks like you're running the shell as a script, not a shell. Fish will just run your java command and then exit.

Take the bang out of that script and make it executable and you can just run it as

/path/to/fish /path/to/script

I believe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文