2

我需要使用 scala 执行脚本。当我使用 ! 执行 Seq 时 换行后的字符串丢失。那就是“Here is the”字符串在新行丢失后更新为 Jira 和字符串的另一部分。据我了解,这是由于!不维护新线。谁能建议我如何解决这个问题?请参阅下面的代码。

import scala.sys.process._

val fileContent: String = """ Here is the 

text with 

new line """

Seq("/opt/atlassian-cli-2.6.0/atlassian.sh", "jira", "--action", "updateIssue", "--issue", "JIRA-2",  "--field", "customfield_10664" ,"--values", fileContent).! 
4

1 回答 1

7

正如您从下面的代码片段中看到的那样,!保持换行符就好了。您正在调用的脚本可能有问题?

scala> Seq("echo", """hello
     |  world""").!
hello
 world
res5: Int = 0   
于 2012-07-31T09:19:26.957 回答