Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's a shebang line for Scala that doesn't corrupt mimetype?

Tags:

shebang

scala

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" "$@"
!#
like image 594
mcandre Avatar asked Feb 25 '13 22:02

mcandre


1 Answers

The bangshe (!#) might be the problem

I commented out the !# and the following works in my environment:

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
like image 143
Keith Pinson Avatar answered Sep 17 '22 23:09

Keith Pinson