title: Modifying environment variable for a process with scala.sys.process?
body: <p>I want to run my process from scala, with several environment variables modified. For example:</p>
  
  <pre><code>Seq("bash","echo $asdf") !
  </code></pre>
  
  <p>and $asdf set to some value. Is there a way to do this from scala?</p>
  
  <p>EDIT:</p>
  
  <p>The closest I got to it so far:</p>
  
  <pre><code>val pb = new java.lang.ProcessBuilder("bash","echo $asdf")
  pb.environment.put("asdf","value") }
  val p = pb.start()
  io.Source.fromInputStream(p.getInputStream).getLines.toList.foreach(println)
  p.waitFor()
  </code></pre>
  
  <p>But this is ugly.</p>