Executing shell commands from Scala REPL

后端 未结 5 1976
礼貌的吻别
礼貌的吻别 2021-01-01 20:44

An interesting feature of Scala REPL is if you drop any jar in your %SCALA_HOME%\\lib directory, it is available for import from the REPL. I have several jars t

5条回答
  •  遥遥无期
    2021-01-01 21:04

    Alternative: use Scala's sys.process library:

    scala> import sys.process._
    import sys.process._
    
    scala> "ls /home/dcs/scala-2.9.1.final".!
    bin
    doc
    lib
    man
    meta
    misc
    src
    res1: Int = 0
    

提交回复
热议问题