为什么使用fish时sbt会退出?
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不使用 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?
看起来您正在将 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.