什么是 Scala 的 shebang 行不会破坏 mimetype? [英] What's a shebang line for Scala that doesn't corrupt mimetype?

查看:41
本文介绍了什么是 Scala 的 shebang 行不会破坏 mimetype?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用它,但它将 mimetype 更改为 text/x-shellscript,这使得 Emacs 等编辑器将我的代码视为 Shell 脚本.

I've been using this, but it changes the mimetype to text/x-shellscript, which makes editors like Emacs treat my code like Shell scripts.

#!/bin/sh
exec scala "$0" "$@"
!#

推荐答案

bangshe (!#) 可能是问题

我在我的环境中注释掉了 !# 和以下内容:

文件:hello.sh

File: hello.sh

#!/usr/bin/env scala

val name = readLine("What is your name? ")
println("Hello " + name + "!")

更改为可执行权限然后运行:

Changed to executable permissions and then ran:

chmod a+x hello.scala
./hello.scala

这篇关于什么是 Scala 的 shebang 行不会破坏 mimetype?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆