diff --git a/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala b/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala index 9b1da195002c2..6df3c4cbd8a2c 100644 --- a/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala +++ b/repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala @@ -910,6 +910,7 @@ class SparkILoop(in0: Option[BufferedReader], protected val out: JPrintWriter, addThunk(printWelcome()) addThunk(initializeSpark()) + addThunk(runShellRC()) // it is broken on startup; go ahead and exit if (intp.reporter.hasErrors) @@ -958,6 +959,17 @@ class SparkILoop(in0: Option[BufferedReader], protected val out: JPrintWriter, sparkContext } + def runShellRC() { + if (System.getenv("SPARK_SHELL_RC") != null) { + loadCommand(System.getenv("SPARK_SHELL_RC")) + } else { + val rc_file = File(System.getProperty("user.home"))/".spark_shell_rc" + if (rc_file.exists) { + loadCommand(rc_file.toString()) + } + } + } + private def getMaster(): String = { val master = this.master match { case Some(m) => m