1

I'm breaking myself into Scala. I got "Hello, World" to echo on the terminal. WOOT!

Here's my new problem: Run rails new <app> by running it with scala. Improvement: It will cd into the <app> folder it will make and then run git init for you.

This is my problem and I want to make the bash script with Scala.

Here was my Hello World script (complete copy from scala lang):

#!/bin/sh
exec scala "$0" "$@"
!#
object HelloWorld extends App {
  println("Hello, World")
}
HelloWorld.main(args)

Does anyone know how to do this? Or how I could at least run ls with the terminal?

Also, is there a way to handle errors with a bash script?

2

1 Answer 1

1

You can look at how a plugin like sbt/sbt-git does implement calls to git.

See the sbt/git/ConsoleGitRunner.scala:

private lazy val cmd = if(isWindowsShell) Seq("cmd", "/c", "git") else Seq("git")

It uses sbt.Process.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.